Hi.
A column's values in a grid are disappearing when the user is doing something on the web-site, like push a button or insert an item in another grid but not when user is inserting a new item in the grid that keep the column that lose it's values. When I refresh the grid, the values are coming back. The column is keeping a bool value from the database that is displaying as text (and as a combobox when inserting items). The code is:
Anyone have an idea why this happens? Perhaps the content is wrong in the ItemTemplate ....
A column's values in a grid are disappearing when the user is doing something on the web-site, like push a button or insert an item in another grid but not when user is inserting a new item in the grid that keep the column that lose it's values. When I refresh the grid, the values are coming back. The column is keeping a bool value from the database that is displaying as text (and as a combobox when inserting items). The code is:
<telerik:GridTemplateColumn HeaderStyle-Width="195px" DataField="Shipregistry" HeaderText="Skipsregister" SortExpression="Shipregistry" UniqueName="Shipregistry"> <ItemTemplate><%#DataBinder.Eval(Container.DataItem, "Shipregistry")%></ItemTemplate> <EditItemTemplate> <telerik:RadComboBox DataTextField="Shipregistry" DataValueField="Shipregistry" ID="ShipregistryComboBox" HighlightTemplatedItems="true" EmptyMessage="Velg et element..." AllowCustomText="true" runat="server" Height="50px" Width="95px" SelectedValue='<%#Bind("Shipregistry") %>' AutoPostBack="true"> <Items> <telerik:RadComboBoxItem runat="server" Text="norsk" Value="NOR"/> <telerik:RadComboBoxItem runat="server" Text="internasjonalt" Value="NIC"/> </Items> </telerik:RadComboBox> <asp:RequiredFieldValidator runat="server" ErrorMessage="*" ForeColor="Red" ControlToValidate="ShipregistryComboBox" ID="RequiredFieldValidator2"></asp:RequiredFieldValidator> </EditItemTemplate><HeaderStyle Width="195px"></HeaderStyle> </telerik:GridTemplateColumn> protected void RadGridFerryReg_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem && e.Item.DataItem is Ferry) { var item = e.Item as GridDataItem;
var ferry = e.Item.DataItem as Ferry;
item["Shipregistry"].Text = ferry.Shipregistry == "NOR" ? "norsk" : "internasjonalt";
} }Anyone have an idea why this happens? Perhaps the content is wrong in the ItemTemplate ....