This is a migrated thread and some comments may be shown as answers.

Generate Dynamic Column & Raise Pop Up On Cell Click

1 Answer 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
chinmaya
Top achievements
Rank 1
chinmaya asked on 26 Nov 2010, 11:29 AM
i want to generate dynamic grid columns , on cell click i need to display a popup window which contain set of countrol

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 Nov 2010, 12:14 PM
Hello Chinmaya,

Following is a sample code to achieve your requirement. Hope this helps.

ASPX:
<telerik:RadWindow ID="RadWindow1" runat="server">
   <ContentTemplate>
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        <asp:Button ID="Button2" runat="server" Text="Submit" />
   </ContentTemplate>
</telerik:RadWindow>

C#:
protected void Page_Load(object sender, EventArgs e)
   {
       if (!IsPostBack)
       {
           GridBoundColumn boundColumn;
           boundColumn = new GridBoundColumn();
           RadGrid1.MasterTableView.Columns.Add(boundColumn);
           boundColumn.DataField = "FirstName";
           boundColumn.HeaderText = "FirstName";
           boundColumn.UniqueName = "FirstName";
            
       }
   }
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridDataItem)
       {
           GridDataItem item = (GridDataItem)e.Item;
           TableCell cell = (TableCell)item["FirstName"];
           cell.Attributes.Add("onclick", "CellClick();");
       }
   }

Java Script:
<script type="text/javascript">
    function CellClick() {
        var oWnd = $find("RadWindow1");
        oWnd.show();
        return false;
    }
</script>

Thanks,
Princy.
Tags
Grid
Asked by
chinmaya
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or