gridview.databind then return the html to another page
2010-01-29 18:11
435 查看
代码
//In the ajax page, override the Render method, after bind, it can Response the html back to the page
protected override void Render(HtmlTextWriter writer)
{
HtmlTextWriter htmlWriter = new HtmlTextWriter(new System.IO.StringWriter());
divResult.RenderControl(htmlWriter);
Response.Write(htmlWriter.InnerWriter.ToString());
}
//this method is needed for Render
public override void VerifyRenderingInServerForm(Control control)
{
}
//Make the gridview have header, so can make it sortable
protected void gvResult_DataBound(object sender, EventArgs e)
{
GridView gvResult = sender as GridView;
if (gvResult.HeaderRow == null)
{
return;
}
gvResult.HeaderRow.TableSection = TableRowSection.TableHeader;
}
//In the ajax page, override the Render method, after bind, it can Response the html back to the page
protected override void Render(HtmlTextWriter writer)
{
HtmlTextWriter htmlWriter = new HtmlTextWriter(new System.IO.StringWriter());
divResult.RenderControl(htmlWriter);
Response.Write(htmlWriter.InnerWriter.ToString());
}
//this method is needed for Render
public override void VerifyRenderingInServerForm(Control control)
{
}
//Make the gridview have header, so can make it sortable
protected void gvResult_DataBound(object sender, EventArgs e)
{
GridView gvResult = sender as GridView;
if (gvResult.HeaderRow == null)
{
return;
}
gvResult.HeaderRow.TableSection = TableRowSection.TableHeader;
}
相关文章推荐
- jump from a html page to another and then come back to certain part of parent html
- [HTML] how to redirect to another page automactilly without js
- How to get the HTML source of a webpage in Ruby
- asp.net配置报错 “An error was encountered. Please return to the previous page and try again. ”
- How to freeze a dynamic aspx page into a static html page (on the server).
- Using ASP.NET and jQuery to Pass Multiple Values from a GridView to Another Page
- the travel of solving iframe navigate to display page of certain part of parent html page
- How to freeze a dynamic aspx page into a static html page (on the server).(转:http://codebetter.com/blogs/peter.van.ooijen/archiv
- How to Customize the Left Navigation Bar of SPPS Home Page [Another Solution]
- How to freeze a dynamic aspx page into a static html page (on the server).
- An error was encountered. Please return to the previous page and try again.
- How to freeze a dynamic aspx page into a static html page (on the server).
- Another app is currently holding the yum lock; waiting for it to exit...
- Adding a step to the Onepage Checkout
- how can i get [5, 7, 13, 2] to go to [5*0, 7*1, 13*2, 2*3] then get the sum of this array.
- use ItemCreated to set the page style of DataGrid
- use meta header to redirect a page to another one
- The page you tried to access (/manager/login.do) does not exist
- ios::ate places the get-position pointer at the file end, enable tellg() to return the size of the f
- Output ASP.NET Page to HTML