Hello, All
I have one issue in my current page , when i am working in RadGrid and I have created grid dynamically and try handle item command event
by writing my code as below mention but not working
I want to create nested grid on clic
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="demotemp.aspx.cs" Inherits="HcareTemplate.demotemp" MasterPageFile="HTemplateMaster.Master" %><%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server"> <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> </telerik:RadAjaxManager></asp:Content>using System;using System.Collections.Generic;using System.Linq;using System.Data;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using Telerik.Web.UI;namespace HcareTemplate{ public partial class demotemp : System.Web.UI.Page { HcareTemplate.HcareTemplateService objService = new HcareTemplate.HcareTemplateService(); DataSet datalist; public void DefineGridStructure() { RadGrid RadGrid1 = new RadGrid(); RadGrid1.ItemCommand += new GridCommandEventHandler(RadGrid1_ItemCommand); RadGrid1.ID = "RadGrid1"; datalist = objService.getSoapTemplateQuestions(1, 16); RadGrid1.DataSource = datalist; RadGrid1.MasterTableView.DataKeyNames = new string[] { "TemplateId" }; RadGrid1.Skin = "Outlook"; RadGrid1.Width = Unit.Percentage(30); RadGrid1.AllowPaging = true; RadGrid1.AutoGenerateColumns = false; RadGrid1.ClientSettings.Selecting.AllowRowSelect = true; //Add columns GridBoundColumn boundColumn; boundColumn = new GridBoundColumn(); boundColumn.DataField = "TemplateId"; boundColumn.HeaderText = "TemplateId"; RadGrid1.MasterTableView.Columns.Add(boundColumn); boundColumn = new GridBoundColumn(); boundColumn.DataField = "ProviderText"; boundColumn.HeaderText = "ProviderText"; RadGrid1.MasterTableView.Columns.Add(boundColumn); this.PlaceHolder1.Controls.Add(RadGrid1); } public void Page_Init(object sender, System.EventArgs e) { DefineGridStructure(); } public void Page_Load(object sender, System.EventArgs e) { RadGrid grid = (RadGrid)PlaceHolder1.FindControl("RadGrid1"); RadAjaxManager1.AjaxSettings.AddAjaxSetting(grid, grid); } public void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == "RowClick") { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "test", "<script>alert('hi');</script>"); GridEditableItem item = e.Item as GridEditableItem; int ParentId = Convert.ToInt32(item.GetDataKeyValue("TemplateId")); DataSet ds = objService.getTemplateProiderText(ParentId); datalist = objService.getSoapTemplateQuestions(1, ParentId); if (datalist.Tables[0].Rows.Count > 0) { DefineGridStructure(); } } } }}k on selected row of current grid
