9 Answers, 1 is accepted
A possible approach is shown below:
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> |
protected void Page_Init(object sender, EventArgs e) |
{ |
RadGrid radGrid = new RadGrid(); |
for (int i = 1; i < 4; i++) |
{ |
radGrid = new RadGrid(); |
radGrid.ID = "radGrid" + i; |
PlaceHolder1.Controls.Add(radGrid); |
radGrid.AutoGenerateColumns = true; |
radGrid.DataSource = SqlDataSource1; //replace with the appropriate code |
} |
} |
RadGrid Programmatic creation
RadGrid Programmatic creation - On PageInit demo
RadGrid Programmatic creation - On PageLoad demo
Greetings,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

The placeholder was used to hold the dynamically created controls. Please examine the provided C# code.
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

this is the message
'System.OutOfMemoryException' was thrown.
Please give us more details on your project. It would be helpful if you share your code with us - you can attach it to a format support ticket for example.
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

the below code is in class function
Public Function SectionReport(ByVal row_id As Integer, ByVal strName As String, ByVal strAddress As String)
SQLConnection.Close()
SQLConnection.Open()
Dim errmsg As String = ""
Dim rs As SqlDataReader
Dim objcmd As New SqlCommand("saStudent", SQLConnection)
objcmd.CommandType = CommandType.StoredProcedure
objcmd.Parameters.AddWithValue(
"@row_id", row_id)
objcmd.Parameters.AddWithValue(
"@strName", 1)
objcmd.Parameters.AddWithValue(
"@strAddress", Address)
Try
rs = objcmd.ExecuteReader()
Catch ex As Exception
errmsg = ex.Message
End Try
return rs
SQLConnection.Close()
rs.Close()
End Function
the code below is in default.aspx.vb
page load
Dim
radGrid As RadGrid = New RadGrid
Dim rsSectionReport As SqlDataReader = AllFunctions.SectionReport(CInt(Request.QueryString("rowid").ToString), CStr(strName), strAddress)
Dim dtSection As Data.DataTable = New Data.DataTable
PlaceHolder1.Controls.Add(radGrid)
radGrid.DataSource = dtSection
radGrid.DataBind()
this will work fine if i replace radgrid with the regular gridview from microsoft.


Please test the attached example.
Additionally I would like to suggest you examine our demo with 1,000,000 records.
Boosting Performance with LINQ
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.