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

Programatic Grid Creation Row Doubt Click Postback

3 Answers 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Justin
Top achievements
Rank 1
Justin asked on 22 Oct 2010, 12:12 AM
Help,

Im trying to create RadTabs and RadGrids dynamically based on database entries.  I also want the RadGrid to postback on double click of the row.  I've tried creating javascript methods for each grid to handle the Double Click Event but the issue I run into is that the $find function cannot find my programitaccally created grids to get their UniqueID.  Is what Im trying to accomplish possible?  Some of my code is below.

Panel GridPanel = new Panel();
  
EntityDataSource NewEDS = CreateDataSource(Tab);
  
GridPanel.Controls.Add(NewEDS);
  
RadGrid NewRG = new RadGrid();
NewRG.ID = "rg" + Tab.WebTabId.ToString();
NewRG.AutoGenerateColumns = true;
NewRG.DataSourceID = NewEDS.ID;
NewRG.MasterTableView.TableLayout = GridTableLayout.Fixed;
NewRG.ClientSettings.Scrolling.AllowScroll = true;
NewRG.ClientSettings.Scrolling.UseStaticHeaders = true;
NewRG.ClientSettings.Selecting.AllowRowSelect = true;
  
GridPanel.Controls.Add(NewRG);
  
string jsText = "function " + NewRG.ID + "_DblClick(sender, eventArgs) {$find('" + RadAjaxManager.ClientID + "').ajaxRequestWithTarget('" + NewRG.UniqueID + "','Select');}";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(),NewRG.ID + "_DblClick", jsText,true);
NewRG.ClientSettings.ClientEvents.OnRowDblClick = NewRG.ID + "_DblClick";

Thanks for any help in advance.

3 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 26 Oct 2010, 02:56 PM
Hello Justin,

The corresponding RadGrid is the sender of the RowDblClick event. You can examine this article to see how the postback can be made.

I hope this helps.

Greetings,
Mira
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Justin
Top achievements
Rank 1
answered on 27 Oct 2010, 07:50 PM
Thanks for your help I found that I had to recreate the Grid on load during postback.  In doing that I didnt have to recreate the datasource or any other items I created, but I assume they are not being affected by the ajax request.

0
Mira
Telerik team
answered on 28 Oct 2010, 01:33 PM
Hello Justin,

Please take a look at the Programmatic creation help topic to see how to create a RadGrid instance dynamically.

I hope it helps.

Greetings,
Mira
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Justin
Top achievements
Rank 1
Answers by
Mira
Telerik team
Justin
Top achievements
Rank 1
Share this question
or