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

Inserting new RadGrid backend (C#)

6 Answers 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 2
Nick asked on 26 Jun 2012, 03:45 PM
Hello,

I was wondering if there is a way to insert a new radgrid in c#. I basically want to have a grid template that i will use a bunch of times on a web page, but the amount of grids i will create depends on the data being passed. Is there a way I can achieve this?

Thanks,

Nick

6 Answers, 1 is accepted

Sort by
0
Nick
Top achievements
Rank 2
answered on 27 Jun 2012, 04:14 PM
Also, if there is a way I can achieve this functionality with another telerik or asp control, please let me know. It's very important that I figure this out quickly.

Thanks
0
Eyup
Telerik team
answered on 27 Jun 2012, 08:03 PM
Hello Nick,

Please check out the following help topic which thoroughly describes how to create and handle RadGrid dynamically:
 Grid / Programmatic Creation ( Section: Creating the grid entirely in the code behind )

Try adding the grid in the regarding template and you will achieve the desired scenario.

All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Nick
Top achievements
Rank 2
answered on 27 Jun 2012, 09:11 PM
Thank you.

I actually found that documentation online before you posted it, but it was still extremely helpful.

However, I still have another question. Each time I create a new radgrid, I want to add an expand/collapse button that hides or shows the grid. I have found documentation that shows how you can show and collapse rows, but this is not what I want. I want to be able to make the entire grid (including the headers) disappear. Also, it would be preferable to use some kind of on click handler (or something similar) so the button can be above the grid, as opposed to being attached to the grid in some way. Is this possible? Thank you in advance.

-Nick
0
Eyup
Telerik team
answered on 28 Jun 2012, 02:09 PM
Hi Nick,

You could try for example:
  mark-up:
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
  C#:
protected void Button1_Click(object sender, EventArgs e)
   {
       RadGrid1.Visible = false;
   }

That should do the trick.

All the best,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Nick
Top achievements
Rank 2
answered on 29 Jun 2012, 02:19 PM
Is there a way to do this programmatically? The nature of the the page I'm making pretty much requires me to do everything programmatically.

Thank you.
0
Eyup
Telerik team
answered on 03 Jul 2012, 02:01 PM
Hello Nick,

Did you mean to hide the grid on initial load? If so, you could add the suggested property as a grid setting when creating the grid programmatically:
RadGrid1.Visible = false;

If this is not what you are looking for, could you please elaborate some more on the issue? On which event do you intend to hide the grid and what you try to achieve by doing so?

Kind regards,
Eyup
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Nick
Top achievements
Rank 2
Answers by
Nick
Top achievements
Rank 2
Eyup
Telerik team
Share this question
or