Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1175
SelectedValue not setted after DataBinding
posted

Hello there,

Hopefully I didnt post this request already, I didnt find anything about it:

We're setting the datasource of the webdatagrid quite simple:

            roleTypes = roleTypes.Where(r => !specialRoles.Contains(r.CDE)).ToList();

            ddlControl.DataSource = roleTypes;
            ddlControl.TextField = "DESCR";
            ddlControl.ValueField = "CDE";
            ddlControl.DataBind();

Nothing special hier, some business logic, then we create a list out of it, set the text- and value-field and bind it.

Works perfect so far, after the binding the first item is selected, which is ok. But when the user doesnt change the selection, the selectedvalue keeps empty and SelectedIem is null.

Only after a manual change of the selection, these 2 properties are filled.


Is that a bug? Since the text is shown, I'd guess this two properties should be filled as well.

Thanks for your response

Matthias

Parents
No Data
Reply
  • 7499
    posted

    Hello Matthias,

    Thank you for posting to Infragistics forums!

    Selected item should be set explicity like below:

    if(!ispostback)

    {

    this.webdropdownprovideer.selecteditemindex=1;

    }

    Let me know if you have any questions.

Children