-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: Rohit_BD
Message 2 in Discussion
You have not specified (1) does each row have it's own drop-down or is there a single
drop-down for the entire datagrid and (2) if each country drop-down in the datagrid
rows has the same data or not. If all drop-downs contain exactly the same data, then
things are considerably simple. I will assume that all country drop-downs have exactly
the same data and that each row has it's own drop-downs. Also, I am assuming that all
the drop-downs have their AutoPostBack set to FALSE. Create a dummy text
server-control (txtDummy). In Page_Load(), write txtDummy.Style.Add("visibility",
"hidden"). Create a server-side onchange handler for it (say, txtDummy_Change). See
below for what to write in the OnChange handler. In the DataGrid's ItemBound event,
use the item's index (ItemIndex) or the Itme object itself to get a handle to the
particular row's (i.e., item's) drop-down. Once you have the handle (say, objDropDown)
of the drop-down (by handle, I mean the variable that holds the drop-down object),
simply, write: objDropDown = DataGrid.Items[ItemIndex].FindControl(<control ID>);
objDropDown.Attributes.Add("onchange", "if(this.selectedIndex > 0)
ddlChanged(this.options[this.selectedIndex].value, " + ItemIndex.ToString() + ")");
In HTML view of the ASPX page, write a function ddlChanged() as: function
ddlChanged(selectedCountry, itemIndex) { document.forms[0].txtDummy.value =
selectedCountry + "~" + itemIndex; __doPostBack("txtDummy", ""); } write the
following in code-behind for the txtDummy_Changed() handler: private void
txtDummy_Changed(....) { string[] myarray = txtDummy.Text.Split("~");
//myarray[0] contains the select country and //myarray[1] contains the row index
(itemIndex) of the //drop-down that was selected //As shown above, again use
the item index (myarray[1]) //to get the handle of the selected rows "State"
drop-down. //After this, use the selected country (myarray[0]) to //populate
the state drop-down. } Hope this helps...
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/mumbaiusergroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]