By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,830 Members | 1,724 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,830 IT Pros & Developers. It's quick & easy.

ASP.Net and client side control (SelectedIndexChanged)

P: n/a
I was wondering what capabilities ASP.Net has at the client level.

I have been using a RadioButtonList.

My control and additional textboxes look like this:

o See item number [ ]
o See items from Date [ ] to date [ ]

I have the method defined for SelectedIndexChanged event. Basically,
I am trying to clear and disable the text selections for the
unselected item.

Example:

private void RadioButtonList1_SelectedIndexChanged(object sender,
System.EventArgs e)
{

if (RadioButtonList1.SelectedValue.ToString() == "ItemNumber")
{

txtFromDate.Text = "";
txtToDate.Text = "";
txtFromDate.Enabled = false;
txtToDate.Enabled = false;
txtItemNumber.Enabled = true;

}
}

The problem is that my SelectedIndexChanged event does not fire until
the post. I can set the AutoPost=True, but this is still doing a
post. That seems like a lot of traffic (back to the server and
running code again, etc) just to disable some client level fields. I
should be able to do this all on the client because the server does
not need to know this information.

Well, I could fall back by writing some JScript to do this for me, but
I thought there would be a native way for ASP.Net to handle this.

Does anyone have any ideas?

Thanks in advance!
Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
If you dont want to post back then, client side JScript is the only option
you have.

"Geordie" <ge*************@abboptical.com> wrote in message
news:73**************************@posting.google.c om...
I was wondering what capabilities ASP.Net has at the client level.

I have been using a RadioButtonList.

My control and additional textboxes look like this:

o See item number [ ]
o See items from Date [ ] to date [ ]

I have the method defined for SelectedIndexChanged event. Basically,
I am trying to clear and disable the text selections for the
unselected item.

Example:

private void RadioButtonList1_SelectedIndexChanged(object sender,
System.EventArgs e)
{

if (RadioButtonList1.SelectedValue.ToString() == "ItemNumber")
{

txtFromDate.Text = "";
txtToDate.Text = "";
txtFromDate.Enabled = false;
txtToDate.Enabled = false;
txtItemNumber.Enabled = true;

}
}

The problem is that my SelectedIndexChanged event does not fire until
the post. I can set the AutoPost=True, but this is still doing a
post. That seems like a lot of traffic (back to the server and
running code again, etc) just to disable some client level fields. I
should be able to do this all on the client because the server does
not need to know this information.

Well, I could fall back by writing some JScript to do this for me, but
I thought there would be a native way for ASP.Net to handle this.

Does anyone have any ideas?

Thanks in advance!

Nov 17 '05 #2

P: n/a
Another option is to use HTML Radio Buttons.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Vaibhav" <co************@yahoo.com> wrote in message
news:ew**************@tk2msftngp13.phx.gbl...
If you dont want to post back then, client side JScript is the only option you have.

"Geordie" <ge*************@abboptical.com> wrote in message
news:73**************************@posting.google.c om...
I was wondering what capabilities ASP.Net has at the client level.

I have been using a RadioButtonList.

My control and additional textboxes look like this:

o See item number [ ]
o See items from Date [ ] to date [ ]

I have the method defined for SelectedIndexChanged event. Basically,
I am trying to clear and disable the text selections for the
unselected item.

Example:

private void RadioButtonList1_SelectedIndexChanged(object sender,
System.EventArgs e)
{

if (RadioButtonList1.SelectedValue.ToString() == "ItemNumber")
{

txtFromDate.Text = "";
txtToDate.Text = "";
txtFromDate.Enabled = false;
txtToDate.Enabled = false;
txtItemNumber.Enabled = true;

}
}

The problem is that my SelectedIndexChanged event does not fire until
the post. I can set the AutoPost=True, but this is still doing a
post. That seems like a lot of traffic (back to the server and
running code again, etc) just to disable some client level fields. I
should be able to do this all on the client because the server does
not need to know this information.

Well, I could fall back by writing some JScript to do this for me, but
I thought there would be a native way for ASP.Net to handle this.

Does anyone have any ideas?

Thanks in advance!


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.