ASP.Net page redirection doubt
I'm kinda new to ASP.NET and I have much more experience with windows forms. I need to show a table with som开发者_JAVA百科e result data in a page Now, with winforms I would do something like this
ResultForm myForm = new ResultForm();
myForm.ResultDataTable = dataTable;
myForm.Show();
Any tip on how could I do something similar with Asp.Net?
tks
You can redirect to a page using Server.Transfer method and in that page use a databound control. You can databind any data controls in ASP.Net, like gridview, datalist etc.
Set the datasource and then databind the control.
Try using the DataGrid ASP.NET control:
In the .ASPX file
<asp:DataGrid runat="server" id="dgData" AutoGenerateColumns="true" />
In the .ASPX.CS file
dgData.DataSource = dataTable;
dgDate.DataBind();
The code that you did work well for "windows-forms", but does not work in ASP.NET. My suggestion, as well as other users too, is that you study a little about web development.
There are huge differences between "web-forms" and "windows-forms", starting with the types of objects and their behavior in the UI.
This code can not be applied to "web-forms" directly.
精彩评论