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

[Solved] RadGrid and RenderControl

1 Answer 227 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason Green
Top achievements
Rank 1
Jason Green asked on 27 May 2008, 06:36 PM
C# code
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
HtmlTextWriter htw = new HtmlTextWriter(sw);
RadGrid1.RenderControl(htw);

RenderControl throws the following exception - 
"Control 'RadGrid1_ctl00_ctl02_ctl00_AddNewRecordButton' of type 'Button' must be placed inside a form tag with runat=server."

ASPX code
<form>
<div>
<table>
<td>
<telerik:RadGrid ID="RadGrid1" Skin="WebBlue" runat="server" AllowPaging="True"PageSize="10" AllowSorting="True" Width="950px" AutoGenerateColumns="False" ShowStatusBar="true"HorizontalAlign="NotSet" OnNeedDataSource="RadGrid1_NeedDataSource" OnUpdateCommand="RadGrid1_UpdateCommand" OnInsertCommand="RadGrid1_InsertCommand" OnDeleteCommand="RadGrid1_DeleteCommand" BorderStyle="Ridge" OnPreRender="RadGrid1_PreRender">
<PagerStyle Mode="NextPrevAndNumeric" />
 <MasterTableView CommandItemDisplay="Top" DataKeyNames="TestID" Width="950px" runat="server">
<Columns>some columns</Columns>
</MasterTableView>
</tererik:RadGrid>
</td>
</table>
</div>
</form>

Using version - RadControls for ASP.NET AJAX

Any thoughts/suggestions?





1 Answer, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 28 May 2008, 05:38 AM
Hello Robert,

You cannot call RenderControl() of an control if this control have child controls which must be placed inside a form - in this case LinkButton.

Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Jason Green
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or