How do you add items on load with the RadGrid?
There will always be the same few items added on data entry every time, but of course they could change sometimes, so I would like to add them to the grid, and then put the grid in edit mode.
Thanks,
Brett
I am using a Button type of image so I am calling the below functon from my onclientclick event
function
spellCheckDescription()
{
var spell = GetRadSpell('<%= txtDescription.ClientID %>');
spell.StartSpellCheck();
return false;
}
This works fine but I would like to pass in the text box control to check instead of hard coding it. I need to check 10 large text fields on my form and do not want to create a function for each, nor check them all at once.
How can I modify the above function so that it is generic to enable the passing of the control?
Thanks.

<telerik:RadChart ID="RadChart1" runat="server"
Skin="WebBlue" AutoLayout="true" Height="350px" Width="680px" SeriesOrientation="Horizontal">
<Series>
<telerik:ChartSeries DataYColumn="Open" Name="Total Open"></telerik:ChartSeries>
<telerik:ChartSeries DataYColumn="Past" Name="Total Past"></telerik:ChartSeries>
</Series>
<PlotArea >
<XAxis AutoScale="True">
<Items>
<telerik:ChartAxisItem TextBlock-Text="Open" />
<telerik:ChartAxisItem TextBlock-Text="Past TAT" />
</Items>
</XAxis>
</PlotArea>
<Legend Appearance-Position-AlignedPosition="right" Visible="false"></Legend>
</telerik:RadChart>
| <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication4._Default" %> |
| <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> |
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" > |
| <head runat="server"> |
| <title></title> |
| </head> |
| <body> |
| <form id="form1" runat="server"> |
| <asp:ScriptManager ID="ScriptManager1" runat="server"> |
| </asp:ScriptManager> |
| <div> |
| <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" |
| AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" |
| GridLines="None" onitemcommand="RadGrid1_ItemCommand" |
| onitemdatabound="RadGrid1_ItemDataBound"> |
| <HeaderContextMenu> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </HeaderContextMenu> |
| <MasterTableView datakeynames="CategoryID" datasourceid="SqlDataSource1"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn DataField="CategoryID" DataType="System.Int32" |
| HeaderText="CategoryID" ReadOnly="True" SortExpression="CategoryID" |
| UniqueName="CategoryID"> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="CategoryName" HeaderText="CategoryName" |
| SortExpression="CategoryName" UniqueName="CategoryName"> |
| </telerik:GridBoundColumn> |
| <telerik:GridButtonColumn CommandName="DeleteP" UniqueName="DeleteP" Text="Delete" ButtonType="PushButton"> |
| </telerik:GridButtonColumn> |
| <telerik:GridButtonColumn CommandName="DeleteL" UniqueName="DeleteL" Text="Delete" ButtonType="LinkButton"> |
| </telerik:GridButtonColumn> |
| </Columns> |
| </MasterTableView> |
| <FilterMenu> |
| <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
| </FilterMenu> |
| </telerik:RadGrid> |
| <asp:SqlDataSource ID="SqlDataSource1" runat="server" |
| ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" |
| SelectCommand="SELECT [CategoryID], [CategoryName], [Description] FROM [Categories]"> |
| </asp:SqlDataSource> |
| </div> |
| <telerik:RadAjaxManager runat="server"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="RadGrid1"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManager> |
| </form> |
| </body> |
| </html> |
| using System.Web.UI; |
| using System.Web.UI.WebControls; |
| using Telerik.Web.UI; |
| namespace WebApplication4 |
| { |
| public partial class _Default : Page |
| { |
| protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| string cmdName = e.CommandName; |
| string cmdArg = e.CommandArgument.ToString(); |
| } |
| protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) |
| { |
| if (e.Item is GridDataItem) |
| { |
| var dataBoundItem = e.Item as GridDataItem; |
| var btnP = dataBoundItem["DeleteP"].Controls[0] as Button; |
| btnP.OnClientClick = "return confirm('ok " + dataBoundItem["CategoryName"].Text + "?');"; |
| btnP.CommandArgument = dataBoundItem["CategoryID"].Text; |
| var btnL = dataBoundItem["DeleteL"].Controls[0] as LinkButton; |
| btnL.OnClientClick = btnP.OnClientClick; |
| btnL.CommandArgument = btnP.CommandArgument; |
| } |
| } |
| } |
| } |