Developer forum

Forum » Development » EditableGrid dropdown column

EditableGrid dropdown column

Marco Santos
Reply

Hello.

 

I am using a EditableGrid where one of the columns has a dropdown list. In order to fill it I have an NewRowInitialize handler:

 

        protected void GrdPriceConditionOnNewRowInitialize(object sender, EditableGridRowEventArgs e)
        {
            if (e.Row.RowType != DataControlRowType.DataRow) return;

            var ddlComparison = (DropDownList)e.Row.FindControl("ddlComparison");

            FillComparisonDropDown(ddlComparison);
        }

 

The problem is when I try to save (going through each row in the view) the control does not have the selected value. Now, I have been able to get the selected value using this:

 

                    DropDownList ddlComparison = (DropDownList)row.FindControl("ddlComparison");
                    string selectedValue = HttpContext.Current.Request[ddlComparison.UniqueID];

 

and this works fine, but it feels like this is not the correct way to go about it, like it´s not very ASP.NET like, if you know what I mean. So I was wondering if anyone knows another way to get the value, in case I am missing something.

 

Thanks.


Replies

 

You must be logged in to post in the forum