Hi,
i have two problems with a grid in batch editing mode and RadDropDownList inside the grid. I set the databinding in code behind for both. The databinding of the RadDropDownList is in the prerender section of the grid:
protected void rgPmls_PreRender(object sender, EventArgs e)
{RadDropDownList rcbCarrier = (RadDropDownList)rgPmls.FindControl(rgPmls.MasterTableView.ClientID + "_CarrierId").FindControl("rcbCarrier");
Carrier getCarrier = new Carrier();
rcbCarrier.DataSource = getCarrier.GetCarrier();
rcbCarrier.DataTextField = "Carrier";
rcbCarrier.DataValueField = "CarrierId";
rcbCarrier.DataBind();
}
Here is the grid:
<telerik:RadGrid ID="rgPmls" runat="server" AllowAutomaticDeletes="True"
AllowAutomaticInserts="True" Skin="Windows7" OnItemInserted="rgPmls_ItemInserted"
OnItemUpdated="rgPmls_ItemUpdated" AllowAutomaticUpdates="True" AllowPaging="True"
AutoGenerateColumns="False" Width="1650px" OnBatchEditCommand="rgPmls_BatchEditCommand" Culture="de-DE" OnItemCommand="rgPmls_ItemCommand" OnNeedDataSource="rgPmls_NeedDataSource" OnPreRender="rgPmls_PreRender">
<MasterTableView CommandItemDisplay="Top" DataKeyNames="LoadingscheduleId"
HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False">
<BatchEditingSettings EditType="Cell" />
<Columns>
<telerik:GridTemplateColumn HeaderText="Reeder" HeaderStyle-Width="110px" UniqueName="CarrierId" DataField="CarrierId">
<ItemTemplate>
<%# Eval("Carrier") %>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadDropDownList runat="server" ID="rcbCarrier" DataValueField="CarrierId"
DataTextField="Carrier" Width="100">
</telerik:RadDropDownList>
</EditItemTemplate>
<HeaderStyle Width="110px" HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
</Columns>
<ClientSettings AllowKeyboardNavigation="true">
<Scrolling AllowScroll="True" FrozenColumnsCount="3" UseStaticHeaders="True" />
</ClientSettings></telerik:RadGrid>
The databinding works fine and I can see all the items in the RadDropDownList. But I have the problems when I update the grid:
First problem: When I update the grid in batch editing mode all works fine at the first time and i get the selectedvalues of the RadDrobDownList. When I update
the grid a second time with a new seleted item, I get no value back.
Second problem: When the RadDropDownList has only one item, I also get no value back
What do I forget?
Thx for help.
Regards Thomas
i have two problems with a grid in batch editing mode and RadDropDownList inside the grid. I set the databinding in code behind for both. The databinding of the RadDropDownList is in the prerender section of the grid:
protected void rgPmls_PreRender(object sender, EventArgs e)
{RadDropDownList rcbCarrier = (RadDropDownList)rgPmls.FindControl(rgPmls.MasterTableView.ClientID + "_CarrierId").FindControl("rcbCarrier");
Carrier getCarrier = new Carrier();
rcbCarrier.DataSource = getCarrier.GetCarrier();
rcbCarrier.DataTextField = "Carrier";
rcbCarrier.DataValueField = "CarrierId";
rcbCarrier.DataBind();
}
Here is the grid:
<telerik:RadGrid ID="rgPmls" runat="server" AllowAutomaticDeletes="True"
AllowAutomaticInserts="True" Skin="Windows7" OnItemInserted="rgPmls_ItemInserted"
OnItemUpdated="rgPmls_ItemUpdated" AllowAutomaticUpdates="True" AllowPaging="True"
AutoGenerateColumns="False" Width="1650px" OnBatchEditCommand="rgPmls_BatchEditCommand" Culture="de-DE" OnItemCommand="rgPmls_ItemCommand" OnNeedDataSource="rgPmls_NeedDataSource" OnPreRender="rgPmls_PreRender">
<MasterTableView CommandItemDisplay="Top" DataKeyNames="LoadingscheduleId"
HorizontalAlign="NotSet" EditMode="Batch" AutoGenerateColumns="False">
<BatchEditingSettings EditType="Cell" />
<Columns>
<telerik:GridTemplateColumn HeaderText="Reeder" HeaderStyle-Width="110px" UniqueName="CarrierId" DataField="CarrierId">
<ItemTemplate>
<%# Eval("Carrier") %>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadDropDownList runat="server" ID="rcbCarrier" DataValueField="CarrierId"
DataTextField="Carrier" Width="100">
</telerik:RadDropDownList>
</EditItemTemplate>
<HeaderStyle Width="110px" HorizontalAlign="Center" />
</telerik:GridTemplateColumn>
</Columns>
<ClientSettings AllowKeyboardNavigation="true">
<Scrolling AllowScroll="True" FrozenColumnsCount="3" UseStaticHeaders="True" />
</ClientSettings></telerik:RadGrid>
The databinding works fine and I can see all the items in the RadDropDownList. But I have the problems when I update the grid:
First problem: When I update the grid in batch editing mode all works fine at the first time and i get the selectedvalues of the RadDrobDownList. When I update
the grid a second time with a new seleted item, I get no value back.
Second problem: When the RadDropDownList has only one item, I also get no value back
What do I forget?
Thx for help.
Regards Thomas