I have this control:
<asp:DropDownList ID="ddlPaging" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlPaging_SelectedIndexChanged">
</asp:DropDownList>
Here how I bind the data on server side to the control above:
ddlPaging.Visible = true;
ddlPaging.DataSource = Enumerable.Range(0, features.Count()).ToList();
ddlPaging.DataBind();
when I make selection in DropDownList postBack accrued and this function is fired:
protected void Page_Load(object sender, EventArgs e)
{
string controlId= this.FindControl(this.Request.Params.Get("__EVENTTARGET")).ID
//always empty
string ctrlarg1 = this.Request.Params.Get("__EVENTARGUMENT");
string ctrlarg2 = Request.Form["__EVENTARGUMENT"];
string ctrlarg3 = Request.Params["__EVENTARGUMENT"];
string ctrlarg4 = this.Request["__EVENTARGUMENT"];
string ctrlarg5 = this.Request.Params.Get("__EVENTARGUMENT");
if (!isPaging)
{
ddlPaging.Visible = true;
ddlPaging.DataSource = Enumerable.Range(0, features.Count()).ToList();
ddlPaging.DataBind();
}
}
When Page_Load method is fired I need to get the selected item in dropdownlist.
I try this way:
string ctrlarg1 = this.Request.Params.Get("__EVENTARGUMENT");
string ctrlarg2 = Request.Form["__EVENTARGUMENT"];
string ctrlarg3 = Request.Params["__EVENTARGUMENT"];
string ctrlarg4 = this.Request["__EVENTARGUMENT"];
string ctrlarg5 = this.Request.Params.Get("__EVENTARGUMENT");
but the result is empty.
While when I get ID of control this way:
string controlId= this.FindControl(this.Request.Params.Get("__EVENTTARGET")).ID
it works perfect!
So my question is, how do I get selected item in dropdownlist in Page_Load method ?