Hi,
Im using a web form that contains a button(having id=btnSubmit) dropdownlist(having id='ddlDynamic') and a panel which has a dynamicpopulateextender that makes use of the fllg webservice method
[System.Web.Services.WebMethodAttribute(),
System.Web.Script.Services.ScriptMethodAttribute()]
public static string GetDynamicContent3(string contextKey)
{
DropDownList lsDynamic = new DropDownList();
lsDynamic.ID = "lsDynamic";
lsDynamic.Items.Add(new ListItem("Numba1"));
lsDynamic.Items.Add(new ListItem("Numba2"));
lsDynamic.Items[1].Selected = true;
/*These values are just sample values which will actually be coming from a database
Even the item is selected based on another database value*/
lsDynamic.Attributes.Add("onchange","caller(this.value)");
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
lsDynamic.RenderControl(htw);
htw.Close();
return sw.ToString();
}
Now at page load this panel will already be containing an empty listbox with id 'lsDynamic'
As you can see I am creating a new listbox with a selected item in the panel to replace the old empty one.(I hope my terminology is correct)
This web service method kicks into action when i change the index of ddlDynamic
The listbox and the selecteditem also gets rendered fine inside the panel but when i click btnSubmit, I am unable to retrieve the selected index of the listbox
It always returns Null. Is there something else i need to do in order to properly register the new control I have added so that server side events can handle it properly.
Do help me out in this regard.
Let me know if you guys need any more info which would help you solve my problem
Kindly forgive me if I ve forgotten to do something very obvious because as i said 'Im new to Ajax'
Regards
RonJac