Hello,
I'm using the telerik grid but when I try to update any of the information, the grid disappears completely. Following are the steps I follow:
1. Click on the 'Edit' button for any of the row and update any information.
2. Press Update button.
As soon as I press 'Update' button, grid disappears. And when I reload the page, it appears again.
Following is the html code:
And following is the code behind:
Can some one help me with this issue?
I'm using the telerik grid but when I try to update any of the information, the grid disappears completely. Following are the steps I follow:
1. Click on the 'Edit' button for any of the row and update any information.
2. Press Update button.
As soon as I press 'Update' button, grid disappears. And when I reload the page, it appears again.
Following is the html code:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="tgLicenseInfo"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="tgLicenseInfo" LoadingPanelID="RadAjaxLoadingPanel1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings></telerik:RadAjaxManager><telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /><telerik:RadGrid ID="tgLicenseInfo" runat="server" AutoGenerateColumns="false" AllowSorting="true" AllowPaging="true" AllowFilteringByColumn="true" OnNeedDataSource="tgLicenseInfo_NeedDataSource" OnUpdateCommand="tgLicense_UpdateCommand"> <EditItemStyle BackColor="AliceBlue" /> <PagerStyle Mode="NextPrevAndNumeric" /> <MasterTableView AutoGenerateColumns="False" DataKeyNames="ID" CommandItemDisplay="TopAndBottom" EditFormSettings-PopUpSettings-Modal="true"> <Columns> <telerik:GridEditCommandColumn ButtonType="ImageButton" HeaderStyle-HorizontalAlign="Center" UniqueName="EditCommandColumn" HeaderText="Edit" ItemStyle-HorizontalAlign="Center" /> <telerik:GridBoundColumn DataField="ID" UniqueName="ID" Visible="false" /> <telerik:GridBoundColumn DataField="LNumber" HeaderText="License #" SortExpression="LNumber" UniqueName="LNumber" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" /> <telerik:GridBoundColumn DataField="StateDesc" HeaderText="State" SortExpression="StateDesc" UniqueName="StateDesc" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" /> <telerik:GridBoundColumn DataField="LType" HeaderText="Type" SortExpression="LType" UniqueName="LType" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" /> <telerik:GridBoundColumn DataField="LHolder" HeaderText="Holder" SortExpression="LHolder" UniqueName="LHolder" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" /> <telerik:GridBoundColumn DataField="LExpireDate" HeaderText="ExpireDate" SortExpression="LExpireDate" UniqueName="LExpireDate" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" /> <telerik:GridBoundColumn DataField="LicenseStatus" HeaderText="Status" SortExpression="LicenseStatus" UniqueName="LicenseStatus" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" /> <telerik:GridBoundColumn DataField="VerifiedByUserID" HeaderText="Verified By" SortExpression="VerifiedByUserID" UniqueName="VerifiedByUserID" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" /> <telerik:GridButtonColumn Text="Delete" CommandName="Delete" HeaderText="Delete" ButtonType="ImageButton" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" /> </Columns> <EditFormSettings EditFormType="Template"> <EditColumn UniqueName="EditColumn"> </EditColumn> <FormTemplate> <table border="0" cellpadding="2"> <tr> <td> License #: </td> <td><asp:TextBox ID="txtLNumber" Width="150px" Text='<%# Bind( "LNumber") %>' runat="server"></asp:TextBox> </td> </tr> <tr> <td> State: </td> <td><asp:TextBox ID="txtState" Width="150px" Text='<%# Bind( "StateDesc") %>' runat="server"></asp:TextBox> </td> </tr> <tr> <td> Type: </td> <td><asp:TextBox ID="txtLType" Width="150px" Text='<%# Bind( "LType") %>' runat="server"></asp:TextBox> </td> </tr> <tr> <td> Holder: </td> <td><asp:TextBox ID="txtLHolder" Width="150px" Text='<%# Bind( "LHolder") %>' runat="server"></asp:TextBox> </td> </tr> <tr> <td> Exp Date: </td> <td><asp:TextBox ID="txtLExpireDate" Width="150px" Text='<%# Bind( "LExpireDate") %>' runat="server"></asp:TextBox> </td> </tr> <tr> <td> Status: </td> <td><asp:TextBox ID="txtStatus" Width="150px" Text='<%# Bind( "LicenseStatus") %>' runat="server"></asp:TextBox> </td> </tr> <tr> <td> Verified By: </td> <td><asp:TextBox ID="txtVerifiedByUserID" Width="150px" Text='<%# Bind( "VerifiedByUserID") %>' runat="server"></asp:TextBox> </td> </tr> </table> <asp:Button ID="Button3" CommandName="Update" Text="Update" runat="server" /> <asp:Button ID="Button3a" CommandName="Cancel" Text="Cancel" runat="server" /> </FormTemplate> </EditFormSettings> </MasterTableView></telerik:RadGrid>And following is the code behind:
protected void tgLicense_UpdateCommand(object source, GridCommandEventArgs e){ try { if (e.CommandName == RadGrid.UpdateCommandName) { if (e.Item is GridEditFormItem) { GridEditFormItem item = (GridEditFormItem)e.Item; int iLID = Convert.ToInt32(item.GetDataKeyValue("ID")); if (iLID != 0) { TextBox txtLHolder = (TextBox)item.FindControl("txtLHolder"); TextBox txtLType = (TextBox)item.FindControl("txtLType"); TextBox txtLExpireDate = (TextBox)item.FindControl("txtLExpireDate"); TextBox txtLicenseStatus = (TextBox)item.FindControl("txtStatus"); TextBox txtVerifiedByUserID = (TextBox)item.FindControl("txtVerifiedByUserID"); TextBox txtState = (TextBox)item.FindControl("txtState"); // DropDownList drdState = (DropDownList)item.FindControl("drdState"); SaisUser oUser = (SaisUser)Cache[this.GUID + "User"]; AgentLicense oLI = oUser.AgentInProcess.LicenseInfo[iLID]; oLI.LExpireDate = txtLExpireDate.Text; oLI.LHolder = txtLHolder.Text; oLI.LicenseStatus = Convert.ToBoolean(txtLicenseStatus.Text); oLI.VerifiedByUserID = txtVerifiedByUserID.Text; oLI.LType = txtLType.Text; // oLI.LState = drdState.SelectedItem.Value; oLI.LState = txtState.Text; //here license is saved ProcessResult oPR = oLI.Save(this.CnxnString, this.LogPath); if (oPR.Exception == null) { oUser.AgentInProcess.LicenseInfo[iLID] = oLI; Cache[this.GUID + "User"] = oUser; this.tgLicenseInfo.Rebind(); } // else // this.lblUpdate.Text = "Error:" + oPR.Exception.Message; } } } } catch (Exception Exc) { string script = "$(function(){initializedialog();showDialog(\"" + Exc.Message + "\");});"; ScriptManager.RegisterStartupScript(this, this.Page.GetType(), "dialog", script, true); }}Can some one help me with this issue?