I have radgrid on my webpage and i have set automatic insert ,update and delete to TRUE. But When I try to update or insert , it puts empty strings into database instead of values in textboxes.Here is my code:-
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/ITIMaster.Master" CodeBehind="AlertTypeAdmin.aspx.vb" Inherits="EmailAlertsMonitor.AlertTypeAdmin" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <telerik:RadGrid ID="gvAlertTypes" runat="server" AutoGenerateColumns="False" Skin="Outlook" CellSpacing="0" DataSourceID="SqlDataSource1" GridLines="None" EnableViewState="False"> <MasterTableView AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" DataKeyNames="Alert_Type_ID" DataSourceID="SqlDataSource1" CommandItemDisplay ="TopAndBottom" EnableViewState="False" > <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings> <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column"> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column"> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"> <ItemStyle CssClass="MyImageButton" /> </telerik:GridEditCommandColumn> <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this Alert Type?" ConfirmDialogType="RadWindow" ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"> <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> </telerik:GridButtonColumn> <telerik:GridTemplateColumn DataField="Alert_Subject" HeaderText ="Alert Subject" FilterControlAltText="Filter column column" UniqueName="column"> <ItemTemplate > <asp:Label ID="lblAlertSubject" runat ="server" Text ='<%#EVAL("Alert_Subject") %>'></asp:Label> </ItemTemplate> <EditItemTemplate > <asp:TextBox ID="txtAlertSubject" runat ="server" Text ='<%#EVAL("Alert_Subject") %>' MaxLength ="250" Width ="400px" TextMode="MultiLine" ></asp:TextBox> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Alert_Sender" HeaderText ="Alert Sender" FilterControlAltText="Filter column column" UniqueName="column1"> <ItemTemplate > <asp:Label ID="lblAlertSender" runat ="server" Text ='<%#EVAL("Alert_Sender") %>'></asp:Label> </ItemTemplate> <EditItemTemplate > <asp:TextBox ID="txtAlertSender" runat ="server" Text ='<%#EVAL("Alert_Sender") %>' MaxLength ="30" ></asp:TextBox> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Alert_Level" HeaderText ="Alert Level" FilterControlAltText="Filter column column" UniqueName="column2"> <ItemTemplate > <asp:Label ID="lblAlertLevel" runat ="server" Text ='<%#EVAL("Alert_Level") %>'></asp:Label> </ItemTemplate> <EditItemTemplate > <asp:HiddenField ID="hdAlertLevel" runat ="server" Value ='<%#EVAL("Alert_Level_ID") %>' /> <asp:DropDownList ID="ddlAlertLevels" runat ="server" DataSourceID ="SqlDataSource2" DataValueField ="Alert_Level_ID" DataTextField ="Alert_Level" > </asp:DropDownList> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Alert_State" HeaderText ="Alert State" FilterControlAltText="Filter column column" UniqueName="column3"> <ItemTemplate > <asp:Label ID="lblAlertState" runat ="server" Text ='<%#EVAL("Proj_State") %>'></asp:Label> </ItemTemplate> <EditItemTemplate > <asp:HiddenField ID="hdAlertState" runat ="server" Value ='<%#EVAL("Alert_State") %>' /> <asp:DropDownList ID="ddlAlertStates" runat ="server" DataSourceID ="SqlDataSource3" DataValueField ="Proj_State_Code" DataTextField ="Proj_State" > </asp:DropDownList> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Alert_Server" HeaderText ="Alert Server" FilterControlAltText="Filter column column" UniqueName="column4"> <ItemTemplate > <asp:Label ID="lblAlertServer" runat ="server" Text ='<%#EVAL("Alert_Server") %>'></asp:Label> </ItemTemplate> <EditItemTemplate > <asp:TextBox ID="txtAlertServer" runat ="server" Text ='<%#EVAL("Alert_Server") %>' MaxLength ="20" ></asp:TextBox> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Alert_Source" HeaderText ="Alert Source" FilterControlAltText="Filter column column" UniqueName="column5"> <ItemTemplate > <asp:Label ID="lblAlertSource" runat ="server" Text ='<%#EVAL("Alert_Source") %>'></asp:Label> </ItemTemplate> <EditItemTemplate > <asp:TextBox ID="txtAlertSource" runat ="server" Text ='<%#EVAL("Alert_Source") %>' MaxLength ="20" ></asp:TextBox> </EditItemTemplate> </telerik:GridTemplateColumn> </Columns> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn> </EditFormSettings> </MasterTableView> <FilterMenu EnableImageSprites="False"></FilterMenu> <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Outlook"></HeaderContextMenu> </telerik:RadGrid> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>" DeleteCommand="DELETE FROM [Alert_Type] WHERE [Alert_Type_ID] = @Alert_Type_ID" InsertCommand="INSERT INTO [Alert_Type] ([Alert_Subject], [Alert_Sender], [Alert_Level], [Alert_State], [Alert_Server], [Alert_Source]) VALUES (@Alert_Subject, @Alert_Sender, @Alert_Level, @Alert_State, @Alert_Server, @Alert_Source)" SelectCommand="SELECT [Alert_Type_ID],[Alert_Subject],[Alert_Sender],at.Alert_Level as Alert_Level_ID ,al.Alert_Level ,[Alert_State], ast.Proj_State,[Alert_Server],[Alert_Source] FROM [AlertEmailManagement].[dbo].[Alert_Type] at left outer join Alert_Level al on at.Alert_Level =al.Alert_Level_ID left outer join Alert_States ast on at.Alert_State = ast.Proj_State_Code order by alert_state,alert_level_id,alert_source,alert_server " UpdateCommand="UPDATE [Alert_Type] SET [Alert_Subject] = @Alert_Subject, [Alert_Sender] = @Alert_Sender, [Alert_Level] = @Alert_Level, [Alert_State] = @Alert_State, [Alert_Server] = @Alert_Server, [Alert_Source] = @Alert_Source WHERE [Alert_Type_ID] = @Alert_Type_ID"> <DeleteParameters> <asp:Parameter Name="Alert_Type_ID" Type="Int64" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="Alert_Subject" Type="String" /> <asp:Parameter Name="Alert_Sender" Type="String" /> <asp:Parameter Name="Alert_Level" Type="Int16" /> <asp:Parameter Name="Alert_State" Type="String" /> <asp:Parameter Name="Alert_Server" Type="String" /> <asp:Parameter Name="Alert_Source" Type="String" /> </InsertParameters> <UpdateParameters> <asp:Parameter Name="Alert_Subject" Type="String" /> <asp:Parameter Name="Alert_Sender" Type="String" /> <asp:Parameter Name="Alert_Level" Type="Int16" /> <asp:Parameter Name="Alert_State" Type="String" /> <asp:Parameter Name="Alert_Server" Type="String" /> <asp:Parameter Name="Alert_Source" Type="String" /> <asp:Parameter Name="Alert_Type_ID" Type="Int64" /> </UpdateParameters> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>" SelectCommand="SELECT [Proj_State_Code], [Proj_State] FROM [Alert_States] ORDER BY [Proj_State]"> </asp:SqlDataSource> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>" SelectCommand="SELECT [Alert_Level_ID], [Alert_Level] FROM [Alert_Level] ORDER BY [Alert_Level_ID]"> </asp:SqlDataSource> </asp:Content> 