combo box two way binding not passing new selected value to save function , old value is being captured

2 posts, 0 answers
  1. Georges
    Georges avatar
    6 posts
    Member since:
    Sep 2016

    Posted 08 Sep 2016 Link to this post

    Hi i have the two way binding working with rad grid and a rad combobox in a template but when i hit  save the new changed data is not being passed. i keep getting the old bound data. here is the code.                           
        protected void OnClickSave(object sender, EventArgs e)
                foreach (var test in grdStatus.Items)
                  GridEditableItem item = (GridEditableItem)test;
                   QARSubmittal s = item.DataItem as QARSubmittal;
                    RadComboBox comboBox = item.FindControl("CbOracleVerified") as RadComboBox;

                   string format = DataBinder.Eval(item.DataItem, "ORACLE_VERIFIED").ToString(); 


        private void LoadResults()
                var dtosList = new List<QARSubmittal>();
                int counter = 3;
                for (int i = 0; i < counter; i++)
                    var dtos = new QARSubmittal

                        AUDIT_CALENDAR_ID = 11000+i,
                        SUBMITTER_USERID = 1000 + i,
                        RC = 999 + i,
                        STATION = "Atlanta" + i,              
                        ORACLE_VERIFIED = i==1?0:1,
                        TRAFFIC_VERIFIED = 1,
                        DART_VERIFIED = 1,
                        OPERATIVE_VERIFIED = 1,
                        CBSPAYNOW_VERIFIED = 1,
                        ANDO_TRITON_VERIFIED = 1,
                        SUBMITTAL_STATUS = 1000,
                        SUBMITTER = "gabdo" + i,
                        SUBMIT_DATE = DateTime.Today,
                        MARKET = "Atlanta" + i


                grdStatus.DataSource = dtosList;


    here is my html 
                 <telerik:RadGrid runat="server" ID="grdStatus" OnItemCommand="grdStatus_ItemCommand"   AutoGenerateColumns="false"  AllowPaging="false" >
                             <telerik:GridTemplateColumn UniqueName="ORACLE_VERIFIED" HeaderText="Oracle">
                                    <telerik:RadComboBox runat="server" SelectedValue='<%#Bind("ORACLE_VERIFIED") %>' AutoPostBack="false" ID="CbOracleVerified">
                                        <telerik:RadComboBoxItem Text="Not Verified" Value="0" />
                                         <telerik:RadComboBoxItem Text="N/A" Value="-1" />
                                         <telerik:RadComboBoxItem Text="Verified" Value="1" />

         <div class="dialogHeader">
            <table border="0">
                    <td align="left" valign="top">
                        <table cellspacing="5">
                                    <telerik:RadButton runat="server" ID="btnSave" OnClick="OnClickSave" Text="Save" Style="margin-bottom: 0px">
                                    <telerik:RadButton runat="server" ID="btnSubmit" OnClick="OnClickSubmit" Text="Submit">
  2. Veselin Tsvetanov
    Veselin Tsvetanov avatar
    563 posts

    Posted 13 Sep 2016 Link to this post

    Hi Georges,

    The approach chosen won't let you achieve the desired modification of the value for the specific grid row. You will need to place the RadComboBox in an EditItemTemplate and only evaluate the selected value in the ItemTemplate. Possible implementation of similar scenario, could be observed in the following RadGrid demo.

    Veselin Tsvetanov
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top