470,580 Members | 2,202 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,580 developers. It's quick & easy.

Check state on webform

Hello group,
I'm begginer in ASP.net and my question is very simple.
In my webform I have CheckBox (myCB) and DropDownList (myDDL). I want set
myDDL.Enabled =myCB.Checked and show change without refresh
website (without send formular to server) - run this on client site.
Thx
PawelR
Nov 19 '05 #1
9 1599
Is that server side controls or just client side?

"PawelR" <pa************@poczta.onet.pl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello group,
I'm begginer in ASP.net and my question is very simple.
In my webform I have CheckBox (myCB) and DropDownList (myDDL). I want set
myDDL.Enabled =myCB.Checked and show change without refresh
website (without send formular to server) - run this on client site.
Thx
PawelR

Nov 19 '05 #2
ASP.NET is a server side technology. You want to do something on client
side. For this you can just write some javascripts in your aspx file as if
it is a regular html file. All you need to know is what html controls will
represent your server controls on the client. A checkbox will become an
<input type=checkbox> and a ddl will turn into a <select>.

Eliyahu

"PawelR" <pa************@poczta.onet.pl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello group,
I'm begginer in ASP.net and my question is very simple.
In my webform I have CheckBox (myCB) and DropDownList (myDDL). I want set
myDDL.Enabled =myCB.Checked and show change without refresh
website (without send formular to server) - run this on client site.
Thx
PawelR

Nov 19 '05 #3
You can get the client side id for these serverside controls in the code by
using the ClientID attribute for the control. So you can use this to write
the client side code to manipulate this.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:Os**************@tk2msftngp13.phx.gbl...
ASP.NET is a server side technology. You want to do something on client
side. For this you can just write some javascripts in your aspx file as if
it is a regular html file. All you need to know is what html controls will
represent your server controls on the client. A checkbox will become an
<input type=checkbox> and a ddl will turn into a <select>.

Eliyahu

"PawelR" <pa************@poczta.onet.pl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello group,
I'm begginer in ASP.net and my question is very simple.
In my webform I have CheckBox (myCB) and DropDownList (myDDL). I want set
myDDL.Enabled =myCB.Checked and show change without refresh
website (without send formular to server) - run this on client site.
Thx
PawelR


Nov 19 '05 #4
On client site change state dropdownlist control, but use value from
dropdownlist on server site after send form to server.

Użytkownik "Gopalan" <go***************@btinternet.com> napisał w wiadomo¶ci
news:OS**************@tk2msftngp13.phx.gbl...
Is that server side controls or just client side?

"PawelR" <pa************@poczta.onet.pl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello group,
I'm begginer in ASP.net and my question is very simple.
In my webform I have CheckBox (myCB) and DropDownList (myDDL). I want set
myDDL.Enabled =myCB.Checked and show change without refresh
website (without send formular to server) - run this on client site.
Thx
PawelR


Nov 19 '05 #5
Thx,
but I don't know JavaScript can you help me?
In dropdownlist I use data from dataSet - from sql dataBase - this dynamic
list.

Użytkownik "Eliyahu Goldin" <re*************@monarchmed.com> napisał w
wiadomo¶ci news:Os**************@tk2msftngp13.phx.gbl...
ASP.NET is a server side technology. You want to do something on client
side. For this you can just write some javascripts in your aspx file as if
it is a regular html file. All you need to know is what html controls will
represent your server controls on the client. A checkbox will become an
<input type=checkbox> and a ddl will turn into a <select>.

Eliyahu

"PawelR" <pa************@poczta.onet.pl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello group,
I'm begginer in ASP.net and my question is very simple.
In my webform I have CheckBox (myCB) and DropDownList (myDDL). I want set
myDDL.Enabled =myCB.Checked and show change without refresh
website (without send formular to server) - run this on client site.
Thx
PawelR


Nov 19 '05 #6
Try this...

<HTML>
<script language="javascript">
function myCB_CheckedChanged()
{
if (document.getElementById("myCB").checked == true)
document.getElementById("myDDL").disabled = false;
else
document.getElementById("myDDL").disabled = true;
}
</script>
<body>
<form id="Form1" method="post" runat="server">
<asp:CheckBox id="myCB" onclick="myCB_CheckedChanged();" runat="server"
Text="My Check Box" Checked=True />
<br>
<asp:DropDownList id="myDDL" runat="server"/>
</form>
</body>
</HTML>

"PawelR" wrote:
Thx,
but I don't know JavaScript can you help me?
In dropdownlist I use data from dataSet - from sql dataBase - this dynamic
list.

UÂżytkownik "Eliyahu Goldin" <re*************@monarchmed.com> napisaÂł w
wiadomo¶ci news:Os**************@tk2msftngp13.phx.gbl...
ASP.NET is a server side technology. You want to do something on client
side. For this you can just write some javascripts in your aspx file as if
it is a regular html file. All you need to know is what html controls will
represent your server controls on the client. A checkbox will become an
<input type=checkbox> and a ddl will turn into a <select>.

Eliyahu

"PawelR" <pa************@poczta.onet.pl> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello group,
I'm begginer in ASP.net and my question is very simple.
In my webform I have CheckBox (myCB) and DropDownList (myDDL). I want set
myDDL.Enabled =myCB.Checked and show change without refresh
website (without send formular to server) - run this on client site.
Thx
PawelR



Nov 19 '05 #7
Try this...

<HTML>
<script language="javascript">
function myCB_CheckedChanged()
{
if (document.getElementById("myCB").checked == true)
document.getElementById("myDDL").disabled = false;
else
document.getElementById("myDDL").disabled = true;
}
</script>
<body>
<form id="Form1" method="post" runat="server">
<asp:CheckBox id="myCB" onclick="myCB_CheckedChanged();" runat="server"
Text="My Check Box" Checked=True />
<br>
<asp:DropDownList id="myDDL" runat="server"/>
</form>
</body>
</HTML>
Nov 19 '05 #8
Try this...

<script language="javascript">
function myCB_CheckedChanged()
{
if (document.getElementById("myCB").checked == true)
document.getElementById("myDDL").disabled = false;
else
document.getElementById("myDDL").disabled = true;
}
</script>
<body>
<form id="Form1" method="post" runat="server">
<asp:CheckBox id="myCB" onclick="myCB_CheckedChanged();" runat="server"
Text="My Check Box" Checked="True" />
<br>
<asp:DropDownList id="myDDL" runat="server" />
</form>
</body>
Nov 19 '05 #9
Sorry about the multiple messages, first few responded saying that they were
unsuccessfully sent.
Nov 19 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by AvailBrad | last post: by
reply views Thread by Bruno Ferreira | last post: by
1 post views Thread by Dan | last post: by
reply views Thread by dotnet_vb_newbie | last post: by
9 posts views Thread by cashdeskmac | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.