or
<telerik:RadAutoCompleteBox ID="rdtxt" runat="server" Width="90%" EmptyMessage="enter country to search" InputType="Token" Filter="StartsWith" AllowCustomEntry="true"><TextSettings SelectionMode="Single" /><WebServiceSettings Method="GetCountries" Path="frmPage1.aspx" /></telerik:RadAutoCompleteBox>
<telerik:RadGrid ID="TasksAssignedGrid" runat="server" AllowFilteringByColumn="True" AllowMultiRowSelection="true" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="false" GridLines="None" Skin="Metro" ValidationSettings-EnableValidation="true" ClientSettings-AllowColumnsReorder="true" OnExcelMLExportStylesCreated="TasksAssignedGrid_ExcelMLExportStylesCreated" OnExcelMLExportRowCreated="TasksAssignedGrid_ExcelMLExportRowCreated"><MasterTableView DataKeyNames="TaskNo" AllowMultiColumnSorting="true"> <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings><telerik:RadAjaxManager runat="server" ID="RadAjaxManager1"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="TasksAssignedGrid"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="TasksAssignedGrid" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager>
grd.RenderControl(htmlWriter)
line is executed, an error is being thrown stating that the GridLinkButtons must be placed within a form tag. My goal is to extract the HTML markup of the header columns and grid data items only - if this approach won't work, then I will probably have to look into a technique that will iterate each row of the grid and manually write the HTML (I'd like to avoid this if at all possible). Here is the code that I have at this point:
public static string ConvertRadGridToHTML(ref Telerik.Web.UI.RadGrid grd) { var stringwriter = new StringWriter(); var htmlWriter = new HtmlTextWriter(stringwriter); string result; try { htmlWriter.RenderBeginTag(HtmlTextWriterTag.Html); htmlWriter.RenderBeginTag(HtmlTextWriterTag.Body); grd.RenderControl(htmlWriter); htmlWriter.RenderEndTag(); htmlWriter.RenderEndTag(); htmlWriter.Flush(); result = htmlWriter.ToString(); } catch { result = String.Empty; } finally { htmlWriter.Close(); stringwriter.Close(); } return result; }