开发者

ASP.Net page redirection doubt

开发者 https://www.devze.com 2022-12-19 10:15 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号