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
};
dtosList.Add(dtos);
}
grdStatus.DataSource = dtosList;
grdStatus.Rebind();
}
here is my html
<telerik:RadGrid runat="server" ID="grdStatus" OnItemCommand="grdStatus_ItemCommand" AutoGenerateColumns="false" AllowPaging="false" >
<MasterTableView DataKeyNames="QAR_SUBMITTAL_ID,AUDIT_CALENDAR_ID,SUBMITTER_USERID,RC, MARKET, STATION, ORACLE_VERIFIED, TRAFFIC_VERIFIED,
ANDO_TRITON_VERIFIED,DART_VERIFIED,OPERATIVE_VERIFIED,CBSPAYNOW_VERIFIED,SUBMITTER">
<Columns>
<telerik:GridTemplateColumn UniqueName="ORACLE_VERIFIED" HeaderText="Oracle">
<ItemTemplate>
<telerik:RadComboBox runat="server" SelectedValue='<%#Bind("ORACLE_VERIFIED") %>' AutoPostBack="false" ID="CbOracleVerified">
<Items>
<telerik:RadComboBoxItem Text="Not Verified" Value="0" />
<telerik:RadComboBoxItem Text="N/A" Value="-1" />
<telerik:RadComboBoxItem Text="Verified" Value="1" />
</Items>
</telerik:RadComboBox>
</Columns>
</MasterTableView>
</telerik:RadGrid>
<div class="dialogHeader">
<table border="0">
<tr>
<td align="left" valign="top">
<table cellspacing="5">
<tr>
<td>
<telerik:RadButton runat="server" ID="btnSave" OnClick="OnClickSave" Text="Save" Style="margin-bottom: 0px">
</telerik:RadButton>
</td>
<td>
<telerik:RadButton runat="server" ID="btnSubmit" OnClick="OnClickSubmit" Text="Submit">
</telerik:RadButton>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
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
};
dtosList.Add(dtos);
}
grdStatus.DataSource = dtosList;
grdStatus.Rebind();
}
here is my html
<telerik:RadGrid runat="server" ID="grdStatus" OnItemCommand="grdStatus_ItemCommand" AutoGenerateColumns="false" AllowPaging="false" >
<MasterTableView DataKeyNames="QAR_SUBMITTAL_ID,AUDIT_CALENDAR_ID,SUBMITTER_USERID,RC, MARKET, STATION, ORACLE_VERIFIED, TRAFFIC_VERIFIED,
ANDO_TRITON_VERIFIED,DART_VERIFIED,OPERATIVE_VERIFIED,CBSPAYNOW_VERIFIED,SUBMITTER">
<Columns>
<telerik:GridTemplateColumn UniqueName="ORACLE_VERIFIED" HeaderText="Oracle">
<ItemTemplate>
<telerik:RadComboBox runat="server" SelectedValue='<%#Bind("ORACLE_VERIFIED") %>' AutoPostBack="false" ID="CbOracleVerified">
<Items>
<telerik:RadComboBoxItem Text="Not Verified" Value="0" />
<telerik:RadComboBoxItem Text="N/A" Value="-1" />
<telerik:RadComboBoxItem Text="Verified" Value="1" />
</Items>
</telerik:RadComboBox>
</Columns>
</MasterTableView>
</telerik:RadGrid>
<div class="dialogHeader">
<table border="0">
<tr>
<td align="left" valign="top">
<table cellspacing="5">
<tr>
<td>
<telerik:RadButton runat="server" ID="btnSave" OnClick="OnClickSave" Text="Save" Style="margin-bottom: 0px">
</telerik:RadButton>
</td>
<td>
<telerik:RadButton runat="server" ID="btnSubmit" OnClick="OnClickSubmit" Text="Submit">
</telerik:RadButton>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>