Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
134 views
Hi,

I've got the following code that I am running server-side to export the grid and save it to PDF. I then don't want to show the Dialog box to the user so I can then do more in code to attach the saved PDF to an email.

This is the code I have to save the file:

protected void grdDailyList_GridExporting(object source, Telerik.Web.UI.GridExportingArgs e)
        {
            string path = Server.MapPath("~/DailyList/list.pdf");
            if (File.Exists(path))
                File.Delete(path);
  
            using (FileStream fs = File.Create(path))
            {
                Byte[] info = System.Text.Encoding.Default.GetBytes(e.ExportOutput);
                fs.Write(info, 0, info.Length);
            }
  
  
        }

How do I then prevent the dialog box from getting displayed?

Or can I move the above code to get the grids ExportOutput code without having to go through this method?

Thanks, Mark
Daniel
Telerik team
 answered on 24 Sep 2010
1 answer
142 views
Hello all,

I have a RadGrid (RadGrid1) with a nestedviewtemplate. In the template, I have a RadToolbar (RadToolBar1) and another RadGrid (RadGrid2). I have set up the data sources and the grid works fine and shows the appropriate child items in the second RadGrid.

My problem is referencing the RadToolbar and the two RadGrids clientside using javascript. When a user selects an option from the RadToolbar1, I need to get row number of RadGrid1 and a reference to RadToolbar1 and RadGrid2 which is inside the nestedviewte,plate.

I have look at many many forum articles and demos and cannot seem to get the correct clientside code. I have included my code below.

Any help would be greatly appreciated.

Thanks
Ryan



<%

@ Page Language="VB" AutoEventWireup="false" CodeFile="gridtest.aspx.vb" Inherits="parkingdashboard" %>

 

<%

@ 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>

 

 

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

 

</

 

head>

 

<

 

body>

 

 

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

 

 

<script type="text/javascript">

 

 

function OnClickToolBar(sender, args) {

 

 

var nGrid = $find("<%= RadGrid1.ClientID %>");

 

 

var nMasterTable = nGrid.get_masterTableView();

 

 

var nNested = nMasterTable.get_dataItems()[0].get_nestedViews();

 

 

alert(nNested[0].get_id());

 

 

if (args.get_item().get_value() == 'showcustomerid') {

 

alert(

"Toolbar Select: CustomerID");

 

}

 

else if (args.get_item().get_value() == 'showorderid') {

 

alert(

"Toolbar Select: OrderID");

 

}

 

else if (args.get_item().get_value() == 'showlinkid') {

 

alert(

"Toolbar Select: LinkID");

 

}

 

else {

 

alert(

"Toolbar Select: UnknownID");

 

}

}

 

</script>

 

 

</telerik:RadCodeBlock>

 

 

<form id="form1" runat="server">

 

 

<table align="left" cellpadding="5" cellspacing="0">

 

 

<tr>

 

 

<td>

 

 

<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1"

 

 

Skin="Windows7" AllowSorting="True">

 

<

 

MasterTableView AutoGenerateColumns="False" DataKeyNames="customerid"

 

 

DataSourceID="SqlDataSource1" Width="98%">

 

 

<NestedViewTemplate>

 

 

<table align="left" cellpadding="5" cellspacing="0">

 

 

<tr>

 

 

<td>

 

 

<asp:Label ID="Label1" runat="server" Visible="false" Text='<%# Eval("customerid") %>'></asp:Label>

 

 

 

<asp:SqlDataSource ID="SqlDataSource2"

 

 

ConnectionString="<%$ ConnectionStrings:usmasondataConnectionString %>" SelectCommand="SELECT * FROM [aaOrder] WHERE ([customer_id] = @customer_id)"

 

 

runat="server">

 

 

<SelectParameters>

 

 

<asp:ControlParameter ControlID="Label1" DefaultValue="0" Name="customer_id"

 

 

PropertyName="Text" Type="Int32" />

 

 

</SelectParameters>

 

 

</asp:SqlDataSource>

 

 

<telerik:RadToolBar ID="RadToolBar1" Runat="server"

 

 

onclientbuttonclicked="OnClickToolBar" Skin="Office2007" Width="100%">

 

 

<Items>

 

 

<telerik:RadToolBarDropDown runat="server" Text="Show">

 

 

<Buttons>

 

 

<telerik:RadToolBarButton runat="server" Text="Show OrderID"

 

 

Value="showorderid">

 

 

</telerik:RadToolBarButton>

 

 

<telerik:RadToolBarButton runat="server" Text="Show CustomerID"

 

 

Value="showcustomerid">

 

 

</telerik:RadToolBarButton>

 

 

<telerik:RadToolBarButton runat="server" Text="Show LinkID" Value="showlinkid">

 

 

</telerik:RadToolBarButton>

 

 

</Buttons>

 

 

</telerik:RadToolBarDropDown>

 

 

</Items>

 

 

</telerik:RadToolBar>

 

 

<telerik:RadGrid ID="RadGrid2" runat="server" AllowPaging="True"

 

 

DataSourceID="SqlDataSource2" GridLines="None" Skin="Office2007">

 

 

<MasterTableView AutoGenerateColumns="False" DataKeyNames="id"

 

 

DataSourceID="SqlDataSource2">

 

 

<CommandItemSettings ExportToPdfText="Export to Pdf" />

 

 

<RowIndicatorColumn>

 

 

<HeaderStyle Width="20px" />

 

 

</RowIndicatorColumn>

 

 

<ExpandCollapseColumn>

 

 

<HeaderStyle Width="20px" />

 

 

</ExpandCollapseColumn>

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="id" DataType="System.Int32" HeaderText="id"

 

 

ReadOnly="True" SortExpression="id" UniqueName="id">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="customer_id" DataType="System.Int32"

 

 

HeaderText="customer_id" SortExpression="customer_id" UniqueName="customer_id">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="location" HeaderText="location"

 

 

SortExpression="location" UniqueName="location">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="purchasedate" DataType="System.DateTime"

 

 

HeaderText="purchasedate" SortExpression="purchasedate"

 

 

UniqueName="purchasedate">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="link_id" DataType="System.Int32"

 

 

HeaderText="link_id" SortExpression="link_id" UniqueName="link_id">

 

 

</telerik:GridBoundColumn>

 

 

</Columns>

 

 

</MasterTableView>

 

 

<ClientSettings>

 

 

<Selecting AllowRowSelect="True" />

 

 

</ClientSettings>

 

 

</telerik:RadGrid>

 

 

</td>

 

 

</tr>

 

 

</table>

 

 

</NestedViewTemplate>

 

<

 

CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>

 

<

 

RowIndicatorColumn>

 

<

 

HeaderStyle Width="20px"></HeaderStyle>

 

</

 

RowIndicatorColumn>

 

<

 

ExpandCollapseColumn Visible="True">

 

<

 

HeaderStyle Width="20px"></HeaderStyle>

 

</

 

ExpandCollapseColumn>

 

 

<Columns>

 

 

<telerik:GridBoundColumn DataField="customerid" DataType="System.Int32"

 

 

HeaderText="CustID" ReadOnly="True" SortExpression="customerid"

 

 

UniqueName="customerid">

 

 

<ItemStyle Width="80px" Wrap="False" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="customername" HeaderText="Name"

 

 

SortExpression="customername" UniqueName="customername">

 

 

<ItemStyle Width="200px" Wrap="False" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="customercity" HeaderText="City"

 

 

SortExpression="customercity" UniqueName="customercity">

 

 

<ItemStyle Width="200px" Wrap="False" />

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="customerstate" HeaderText="State"

 

 

SortExpression="customerstate" UniqueName="customerstate">

 

 

<ItemStyle Width="80px" Wrap="False" />

 

 

</telerik:GridBoundColumn>

 

 

</Columns>

 

</

 

MasterTableView>

 

 

<ClientSettings EnableAlternatingItems="False" EnableRowHoverStyle="True">

 

 

<Selecting AllowRowSelect="True" />

 

 

</ClientSettings>

 

 

</telerik:RadGrid>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

 

<asp:SqlDataSource ID="SqlDataSource1"

 

 

ConnectionString="<%$ ConnectionStrings:usmasondataConnectionString %>" SelectCommand="SELECT * FROM [vaaCustomer]"

 

 

runat="server">

 

 

</asp:SqlDataSource>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

 

<telerik:RadScriptManager ID="RadScriptManager1" runat="server">

 

 

</telerik:RadScriptManager>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">

 

 

</telerik:RadAjaxManager>

 

 

</td>

 

 

</tr>

 

 

<tr>

 

 

<td>

 

 

&nbsp;</td>

 

 

</tr>

 

 

</table>

 

 

</form>

 

</

 

body>

 

</

 

html>




 

Iana Tsolova
Telerik team
 answered on 24 Sep 2010
0 answers
122 views
Never mind... :)
TPK
Top achievements
Rank 1
 asked on 24 Sep 2010
7 answers
512 views

How do i generate a radtree view dynamically, i am using a masterpage in the page that i am trying to achieve this, also kindly let me know if i have to make any other changes if i am trying to achieve this if i am doing this in a Usercontrol.

protected void Page_Load(object sender, EventArgs e)
    {
      if (!IsPostBack)
        {
            RadTreeView testTree = new RadTreeView();
            testTree.ID = "testTree";
            RadTreeNode node1 = new RadTreeNode();
            node1.Text = "Project";
            node1.Expanded = true;
            Image img1 = new Image();
            img1.ImageUrl = "~/images/top1.gif";
            node1.Controls.Add(img1);
  
            RadTreeNode node2 = new RadTreeNode();
            node2.Text = "Process";
            Label lblprocess = new Label();
            lblprocess.Text = "MisTesting";
            node2.Controls.Add(lblprocess);
  
            this.Controls.Add(testTree);
        }
    }

please let me know if i am going wrong somewhere...
Yana
Telerik team
 answered on 24 Sep 2010
1 answer
110 views
Hi,
i have a problem to reorder the tabs in radtabstrip.
I tried lots of ways to do the reorder tabs, but i couldn't got the solutions.
below is the rabtabstrip tag
<div runat="server" id="menuDiv">
                                    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" EnableAJAX="true">
                                        <telerik:RadTabStrip ID="emrTab" runat="server" OnClientTabSelected="tabSelect" Orientation="HorizontalTop"
                                            SelectedIndex="0" ReorderTabsOnSelect="true" Skin="Vista" Width="1000" ClickSelectedTab="true" EnableSubLevelStyles="true">                                            
                                        </telerik:RadTabStrip>
                                    </telerik:RadAjaxPanel>
                                </div>


in this tabstrip i have added 15 tabs.

Thanks and regards
Saravanan
Yana
Telerik team
 answered on 24 Sep 2010
6 answers
194 views

Hello:

I have a Website that inherits a .master page. The master page contains a RadWindow and a JavaScript method to show the RadWindow:

<telerik:RadWindow ID="Window1" runat="server" Modal="True" VisibleOnPageLoad="false" EnableShadow="true"
     Behaviors="Close" ReloadOnShow="true" AutoSize="false" Height="600" Width="800">
     <ContentTemplate>
         <asp:UpdatePanel ID="Window1UpdatePanel" runat="server" UpdateMode="Always">
         <ContentTemplate>
         </ContentTemplate>
         </asp:UpdatePanel>
     </ContentTemplate>
 </telerik:RadWindow>
function OpenModalWindow() {
    var oWnd = null;
    oWnd = $find("<%=Window1.ClientID%>"); }
    oWnd.Show();
}

One of my user controls does a response.redirect and loads a user control dynamically. The user controls Load event executes the JavaScript code from server side, which is supposed to show the window. It throws an error saying that oWnd is null (granted the JavaScript code and the modal are on the same master page). If I do a document.getElementById it returns an actual result (but tells me that .Show is an invalid method). So the object seems to exist. I know it's a shot in the dark but does anyone have any suggestions? On controls where the page is NOT redirecting it seems to work fine...thanks!
Georgi Tunev
Telerik team
 answered on 24 Sep 2010
4 answers
81 views
I have a WCF service internal to my Solution and is a Service Reference to the Client, so my Question is how do I set the Path on the Websettings and the Method for my Combobox?
Simon
Telerik team
 answered on 24 Sep 2010
1 answer
111 views

I am using the RadXmlHttpPanel to load a dropdown based on teh value of other dropdown. Below is my case.

I have a state comobo. when user select a value then the county dropdown should list the counties for that state. Both State and County is coming from the DB.

I have the county dropdown in the RadXmlHttpPanel.
My problem is. When the choose the state dropdown for the first time I am seeing the counties populated correctly and I am able to choose from the county list.
But then when I try to change the state then I am not able to do with the mouse. The list of state show in the dropdown but not able to choose from the list. But I am able to use the key board and select and the county dropdown populates accordingly.

Here is the code I am using.

<telerik:RadComboBox ID="cmbState" runat="server" Width="50px" 
    OnClientSelectedIndexChanged="ComboChanged">                                   
</telerik:RadComboBox>
                                  
                                  
<telerik:RadXmlHttpPanel ID="CountyXmlHttpPanel" runat="server" 
    OnServiceRequest="CountyXmlHttpPanel_ServiceRequest" EnableClientScriptEvaluation ="true">
    <telerik:RadComboBox ID="cmbCounty" runat="server" 
        Width="100px" DropDownWidth="250px" >
    </telerik:RadComboBox>
</telerik:RadXmlHttpPanel>      
  
  
function ComboChanged(sender, args) {
    var foundPanel = $find("<%=CountyXmlHttpPanel.ClientID %>");
    var stateCombo = $find("<%= cmbState.ClientID %>");
    var stateVal = stateCombo.get_value();
    foundPanel.set_value(stateVal);
}
  
  
 protected void CountyXmlHttpPanel_ServiceRequest(object sender, Telerik.Web.UI.RadXmlHttpPanelEventArgs e)
        {
            //Bind county here
        }

 

Thanks

 

Pero
Telerik team
 answered on 24 Sep 2010
1 answer
125 views
Hi, Is it possible to assign different templates to different nodes based on the value of a database field? I am binding the treeview to the results of a stored procedure.

Thanks in advance!
Nikolay Tsenkov
Telerik team
 answered on 24 Sep 2010
4 answers
569 views
Hi Everyone,

I am really stuck on how to find a text box control in edit item template after clicking a custom command item inside detail table.

requirement:
- after clicking "Edit" command item in detail table named "Detail2", show the text box "tbVisitSortOrder" 

Please check my aspx code below.
<DetailTables>
                    <rad:GridTableView Name="Detail2"  DataKeyNames="cp_id" DataMember="visit"  CommandItemDisplay="Top" EditMode="InPlace" Width="100%">
                    <CommandItemTemplate>
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td style="width:60%">
                                    <div style="padding:3px 4px 3px 4px">
                                        <table border="0" cellpadding="1" cellspacing="1">
                                            <tr style="font: normal 11px tahoma, Verdana, Helvetica, Sans-serif;vertical-align:middle">
                                                <td>
                                                    <div class="toolbarIconDivider">|</div>
                                                </td>
                                                <td>
                                                    <asp:LinkButton ID="btnAdd" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="InitInsert"><img style="border:0px" alt="" src="../images/addemail.gif" /> Add</asp:LinkButton>
                                                    <asp:LinkButton ID="lnkPerformInsert" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="PerformInsert" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton>
                                                </td>
                                                <td>
                                                    <div class="toolbarIconDivider">|</div>
                                                </td>
                                                <td>
                                                    <asp:LinkButton ID="btnEditSelected"  CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="EditSelected" ><img style="border:0px" alt="" src="../images/edit.gif" /> Edit</asp:LinkButton>
                                                    <asp:LinkButton ID="btnUpdateEdited" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Update" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton>
                                                    <asp:LinkButton ID="btnCancel" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="CancelAll"  Visible="false" CausesValidation="false"><img style="border:0px" alt="" src="../images/cancel.gif" /> Cancel</asp:LinkButton>
                                                </td>
                                                <td>
                                                    <div class="toolbarIconDivider">|</div>
                                                </td>
                                                <td>
                                                    <asp:LinkButton ID="btnDelete" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Delete"  OnClientClick="javascript:return confirm('Are you sure you want to delete this Clinical Pathway Instruction?')" ><img style="border:0px" alt="" src="../images/delete.gif" /> Delete</asp:LinkButton>
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </table>
                     </CommandItemTemplate>                   
                        <DetailTables>
                            <rad:GridTableView  Name="Detail3" DataKeyNames="cpi_id" DataMember="instruction" CommandItemDisplay="Top" EditMode="InPlace" Width="100%">
                            <CommandItemTemplate>
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td style="width:60%">
                                        <div style="padding:3px 4px 3px 4px">
                                            <table border="0" cellpadding="1" cellspacing="1">
                                                <tr style="font: normal 11px tahoma, Verdana, Helvetica, Sans-serif;vertical-align:middle">
                                                    <td>
                                                        <div class="toolbarIconDivider">|</div>
                                                    </td>
                                                    <td>
                                                        <asp:LinkButton ID="btnAdd" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="InitInsert" ><img style="border:0px" alt="" src="../images/addemail.gif" /> Add</asp:LinkButton>
                                                        <asp:LinkButton ID="lnkPerformInsert" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="PerformInsert" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton>
                                                    </td>
                                                    <td>
                                                        <div class="toolbarIconDivider">|</div>
                                                    </td>
                                                    <td>
                                                        <asp:LinkButton ID="btnEditSelected"  CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="EditSelected" ><img style="border:0px" alt="" src="../images/edit.gif" /> Edit</asp:LinkButton>
                                                        <asp:LinkButton ID="btnUpdateEdited" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Update" Visible="false"><img style="border:0px" alt="" src="../images/save.gif" /> Save</asp:LinkButton>
                                                        <asp:LinkButton ID="btnCancel" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="CancelAll" Visible="false" CausesValidation="false"><img style="border:0px" alt="" src="../images/cancel.gif" /> Cancel</asp:LinkButton>
                                                    </td>
                                                    <td>
                                                        <div class="toolbarIconDivider">|</div>
                                                    </td>
                                                    <td>
                                                        <asp:LinkButton ID="btnDelete" CssClass="mu" onmouseover="this.className='mo'" onmouseout="this.className='mu'" runat="server" CommandName="Delete"  OnClientClick="javascript:return confirm('Are you sure you want to delete this Clinical Pathway Instruction?')" ><img style="border:0px" alt="" src="../images/delete.gif" /> Delete</asp:LinkButton>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            </CommandItemTemplate>
                             
                            <Columns>
                            <rad:GridBoundColumn DataField="cpi_id" HeaderText="CPI_ID" UniqueName="CPI_ID" Visible="false"></rad:GridBoundColumn>
                            <rad:GridBoundColumn DataField="instructions" HeaderText="instructions" UniqueName="instructions" Visible="false"></rad:GridBoundColumn>
                            <rad:GridTemplateColumn HeaderText="Instructions" UniqueName="instructions" DataField="instructions">
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "instructions")%>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="tbIns" runat="server" Text='<%# Bind( "instructions") %>' width="100%" TabIndex="1" TextMode="MultiLine" Rows="4"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="descValidator" Runat="server" Display="Dynamic" ControlToValidate="tbIns" ErrorMessage="* Required Field">
                                </asp:RequiredFieldValidator>
                            </EditItemTemplate>
                            <HeaderStyle Width="90%" />
                            </rad:GridTemplateColumn>
                            <rad:GridTemplateColumn HeaderText="Sort Order" UniqueName="sortorder" DataField="sortorder">
                                <ItemTemplate>
                                    <%# DataBinder.Eval(Container.DataItem, "sortorder")%>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="tbSortOrder" runat="server" Text='<%# Bind( "sortorder") %>' width="30px" TabIndex="2"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="descValidator2" Runat="server" Display="Dynamic" ControlToValidate="tbSortOrder" ErrorMessage="* Required Field">
                                </asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Display="Dynamic" ControlToValidate="tbSortOrder" ErrorMessage="Please enter a valid sort order number." ValidationExpression="^\d+$"></asp:RegularExpressionValidator>
                            </EditItemTemplate>
                            </rad:GridTemplateColumn>
                         </Columns>
                            </rad:GridTableView>
                        </DetailTables>
                     
                    <Columns>
                        <rad:GridBoundColumn DataField="cp_id" HeaderText="CP_ID" UniqueName="CP_ID" Visible="false"></rad:GridBoundColumn>
                        <rad:GridBoundColumn DataField="VisitFrequency" HeaderText="VisitFrequency" UniqueName="VisitFrequency" Visible="false"></rad:GridBoundColumn>
                        <rad:GridClientSelectColumn UniqueName="ClientSelectColumnDetail1"></rad:GridClientSelectColumn>
                        <rad:GridTemplateColumn HeaderText="Visit Frequency" UniqueName="VisitFrequency" DataField="VisitFrequency">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "VisitFrequency")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="tbVisit" runat="server" Text='<%# Bind( "VisitFrequency") %>' width="100%" TabIndex="1" ></asp:TextBox>
                                <asp:RequiredFieldValidator ID="descValidator" Runat="server" Display="Dynamic" ControlToValidate="tbVisit" ErrorMessage="* Required Field">
                            </asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <HeaderStyle Width="80%" />
                        </rad:GridTemplateColumn>
                        <rad:GridTemplateColumn HeaderText="Sort Order" UniqueName="Sortorder" DataField="Sortorder">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "Sortorder")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox ID="tbVisitSortOrder" runat="server" Text='<%# Bind( "Sortorder") %>' width="30px" TabIndex="2" Visible="false"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="descValidator2" Runat="server" Display="Dynamic" ControlToValidate="tbVisitSortOrder" ErrorMessage="* Required Field" >
                            </asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" Display="Dynamic" ControlToValidate="tbVisitSortOrder" ErrorMessage="Please enter a valid sort order number." ValidationExpression="^\d+$"></asp:RegularExpressionValidator>
                        </EditItemTemplate>
                        </rad:GridTemplateColumn>               
 
                     </Columns>
                    </rad:GridTableView>
                 </DetailTables>

server side code:

an error will occur "Unable to cast object of type 'Telerik.WebControls.GridCommandItem' to type 'Telerik.WebControls.GridDataItem'." in this line, GridDataItem item = (GridDataItem)e.Item;

protected void MasterGrid_ItemCreated(object sender, GridItemEventArgs e)
        {
            if (e.Item.OwnerTableView.Name == "Detail2" && CommandState == "editselected")
            {
                GridDataItem item = (GridDataItem)e.Item;
                TextBox txtBox = (TextBox)item["Sortorder"].FindControl("tbVisitSortOrder");
                txtBox.Visible = true;
            }
        }


Please help, any response would really be appreciated.

Thanks!
Lyzel
zel
Top achievements
Rank 1
 answered on 24 Sep 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?