How can we handle the onselectedindexchanged event of a dropdownlist in a gridview/datalist?

Up vote 0 down vote favorite share g+ share fb share tw.

I have a simple datalist with a dropdownlist and a textbox. When the dropdownlist selected index changes, I want to load a value into the textbox in that listbox item (i.e. , the textbox on that particular row).

Code' /> How do I do this? The challenge I'm facing is how to find the corresponding textbox to update. E.g.

For a button I'd pass a commandname, and command arguments. And then I'd handle the event in the gridview or datalist to find the corresponding textbox and update the text. What can we do in case of a selectedindex change of a dropdownlist?

Thanks! C# asp.net dropdownlist datalist selectedindexchanged link|improve this question edited Feb 23 at 8:00 asked Feb 23 at 7:48Zesty447219 100% accept rate.

I guess this should work. Try this... protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e) { var ddlList= (DropDownList)sender; var row = (GridViewRow)ddlList. NamingContainer; //get the Id of the row var Id = Convert.

ToInt32(((Label)row. FindControl("IdColumn")). Text); }.

It worked! Thanks! – Zesty Feb 23 at 8:09.

What you should do is the following: private SomeObject o = new SomeObject(); private void o_SomeEvent(...) { } public TheConstructor() { this.o. SomeEvent += new SomeHandler(o_SomeEvent); } which means you have to create a new dropdownlist and attach its event to the dropdownlist you have in the gridview on itemdatabound.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions