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
8920
assigning dynamically different editors for different rows in the same column
posted

Is it possible dynamically assign editor provider to the cell, e.g. in attached site there are two editor providers defined in grid : "wddYesNo" and "wddSvc" ,  wddYesNo now assigned to edit column ‘Question’ I need dynamically reassign on the client side editor “wddSvc” to the same column ‘Question’  for rows where idMaster in ( 3 , 5, 10) . Attached site so if it is possible please show me how .

Thanks.

DynoGridEdit.rar
Parents
No Data
Reply
  • 17559
    posted

    Hello mcseidel ,

     

    You can achieve this functionality by using only one DropDownProvider and changing its data source dynamically when the cell enter edit mode.:

     

        protected void eProvider_ItemsRequested(object sender, DropDownItemsRequestedEventArgs e)
        {
    
            if (e.Value.ToString() == "1")
            {
                ((WebDropDown)sender).Items.Clear();
                ((WebDropDown)sender).Items.Add(new DropDownItem() { Text = "IT Service", Value = "ITS", Selected = false });
                ((WebDropDown)sender).DataBind();
            }
            else
            {
                ((WebDropDown)sender).Items.Clear();
                ((WebDropDown)sender).Items.Add(new DropDownItem() { Text = "Yes", Value = "Yes", Selected = false });
                ((WebDropDown)sender).Items.Add(new DropDownItem() { Text = "No", Value = "No", Selected = false });
                ((WebDropDown)sender).DataBind();
            }
        }
    

     

    For additional reference please check the attached sample which I modified on your behalf.

    DynoGridEdit.zip
Children