I need to change the default small textbox to a textarea in edit mode ( inline) and it's not working, the textarea shows up when i use a template column but when it tries to update the textarea value it throws an error because it cannot find the value even though I set up Update params in the SQL datasource. Is there any sample projects that do this? I am wondering if it cannot find the value because I am using master pages.
Here is the code for the grid:
Here is the error it throws, I am guessing it cannot find the value of the Content template column:
Cannot insert the value NULL into column 'Content', table 'CLSWEB.dbo.tblNews'; column does not allow nulls. UPDATE fails.
Thanks,
Sam
Here is the code for the grid:
<telerik:RadGrid ID="rgNews" runat="server" CellSpacing="0" DataSourceID="sdsNews" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true" GridLines="None" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"> <ClientSettings> <Selecting AllowRowSelect="True" /> </ClientSettings><MasterTableView DataKeyNames="newsID" CommandItemDisplay="Top" AllowAutomaticInserts="true" DataSourceID="sdsNews"><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:GridBoundColumn DataField="newsID" DataType="System.Int32" FilterControlAltText="Filter newsID column" HeaderText="newsID" ReadOnly="True" SortExpression="newsID" UniqueName="newsID" Visible="False"> </telerik:GridBoundColumn> <telerik:GridEditCommandColumn ButtonType="ImageButton" CancelText="" FilterControlAltText="Filter EditCommandColumn column" UpdateText=""> </telerik:GridEditCommandColumn> <telerik:GridBoundColumn DataField="Title" FilterControlAltText="Filter Title column" HeaderText="Title" SortExpression="Title" UniqueName="Title"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Date" FilterControlAltText="Filter Date column" HeaderText="Date" SortExpression="Date" UniqueName="Date"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Author" FilterControlAltText="Filter Author column" HeaderText="Author" SortExpression="Author" UniqueName="Author"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Publication" FilterControlAltText="Filter Publication column" HeaderText="Publication" SortExpression="Publication" UniqueName="Publication"> </telerik:GridBoundColumn> <%-- <telerik:GridBoundColumn DataField="Content" FilterControlAltText="Filter Content column" HeaderText="Content" Visible="False" SortExpression="Content" UniqueName="Content"> </telerik:GridBoundColumn>--%> <telerik:GridTemplateColumn UniqueName="Content" DataField="Content" HeaderText="Content" Visible="false"> <ItemTemplate> <asp:Label ID="lblContent" Text='<%# Bind("Content") %>' runat="server" /> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="txtContent" TextMode="MultiLine" Text='<%# Eval("Content") %>' Height="150" Width="200" runat="server"></asp:TextBox> </EditItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="Link" FilterControlAltText="Filter Link column" HeaderText="Link" SortExpression="Link" Visible="false" UniqueName="Link"> </telerik:GridBoundColumn> <telerik:GridButtonColumn CommandName="Delete" Text="Delete" ButtonType="ImageButton" UniqueName= "DeleteColumn" /> </Columns><EditFormSettings CaptionFormatString="Edit news details for {0}" FormCaptionStyle-Font-Bold="true" FormCaptionStyle-ForeColor="#9d273f" CaptionDataField="Title"><EditColumn FilterControlAltText="Filter EditCommandColumn column" ButtonType="ImageButton"></EditColumn></EditFormSettings></MasterTableView><FilterMenu EnableImageSprites="False"></FilterMenu><HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu> </telerik:RadGrid>
Here is the SQL Datasource code:
<asp:SqlDataSource ID="sdsNews" runat="server"
ConnectionString="<%$ ConnectionStrings:CLSWEBConnectionString %>"
SelectCommand="SELECT [newsID], [Title], [Date], [Author], [Publication], [Content], [Link] FROM [tblNews]"
UpdateCommand="UPDATE [tblNews] set [Title] = @Title, [Date] = @Date, [Author] = @Author, [Publication] = @Publication, [Content] = @Content, [Link] = @Link WHERE [newsID] = @newsID"
DeleteCommand="DELETE FROM [tblNews] WHERE [newsID] = @newsID">
<UpdateParameters>
<asp:Parameter Name="Content" Type="String" />
</UpdateParameters>
</asp:SqlDataSource>
Here is the error it throws, I am guessing it cannot find the value of the Content template column:
Cannot insert the value NULL into column 'Content', table 'CLSWEB.dbo.tblNews'; column does not allow nulls. UPDATE fails.
The statement has been terminated.
Thanks,
Sam