由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
DotNet版 - ASP.NET 难题测试 (2)
相关主题
Re: 请问DATAGRID里的BOUNDCOLUMN HEADER可以又有TEhow to generate table in visual C#
请问DATAGRID里的BOUNDCOLUMN HEADER可以又有TEXT又有asp.net
static or else?Add controls into web form dynamically?
intresting datagrid那个Control可以做这个事情?
ASP.NET IIS6 Hanging problem怎样用c#.net生成一个动态表格?
Visual Studio.net is buggy.datagrid怎样打印(paging)
[转载] C#.NET DATAGRID 问题请教datagrid help
问一个ASP.NET界面的问题,诚恳一问,谢谢!How to Call Stored Procedure in C# .Net?
相关话题的讨论汇总
话题: employee话题: name话题: datagrid话题: string话题: htmlform
进入DotNet版参与讨论
1 (共1页)
p*p
发帖数: 75
1
另外一个例子,动态创建DataGrid。 同样,随便扔个button可以postback. 运行正常.
private class Employee
{
string id;
string name;
public string Id
{
get { return id; }
}
public string Name
{
get { return name; }
}
public Employee(string id, string name)
{
this.id = id;
this.name = name;
}
}
private void Page_Load(object sender, System.EventArgs e)
{
DataGrid grid = new DataGrid() ;
HtmlForm form1 = (HtmlForm)this.FindControl("Form1");
form1.Controls .Add(grid);
if (!IsPostBack)
{
Employee[] people = new Employee[] { new Emp
j**o
发帖数: 4
2
Before the column is added to the grid, the grid should have been filled with
viewstate data. So adding a blank column with the same name would replace the
column already in there? I have to fire up the Reflector to confirm this. If
so, then the adding column operation should be moved inside the "if" block.

【在 p*p 的大作中提到】
: 另外一个例子,动态创建DataGrid。 同样,随便扔个button可以postback. 运行正常.
: private class Employee
: {
: string id;
: string name;
: public string Id
: {
: get { return id; }
: }
: public string Name

b*e
发帖数: 3845
3
I guess it's a similar question that has something to do with viewstate.
PIP, you are so strong in .NET. What do you do for a living?

【在 p*p 的大作中提到】
: 另外一个例子,动态创建DataGrid。 同样,随便扔个button可以postback. 运行正常.
: private class Employee
: {
: string id;
: string name;
: public string Id
: {
: get { return id; }
: }
: public string Name

k****i
发帖数: 1072
4

DataGrid grid = new DataGrid() ;
grid.AutoGenerateColumns = false;
BoundColumn column = new BoundColumn() ;
column.HeaderText = "Name";
column.DataField = "Name";
grid.Columns.Add(column);
HtmlForm form1 = (HtmlForm)this.FindControl("Form1");
form1.Controls .Add(grid);
if (!IsPostBack)
{
Employee[] people = new Employee[] { new Employee("1", "Steve") , new
Employee("2", "John") , } ;
grid.DataSource = people;
grid.DataBind() ;
}

【在 p*p 的大作中提到】
: 另外一个例子,动态创建DataGrid。 同样,随便扔个button可以postback. 运行正常.
: private class Employee
: {
: string id;
: string name;
: public string Id
: {
: get { return id; }
: }
: public string Name

1 (共1页)
进入DotNet版参与讨论
相关主题
How to Call Stored Procedure in C# .Net?ASP.NET IIS6 Hanging problem
hVisual Studio.net is buggy.
datagrid的问题[转载] C#.NET DATAGRID 问题请教
请大侠帮看一下这个问题问一个ASP.NET界面的问题,诚恳一问,谢谢!
Re: 请问DATAGRID里的BOUNDCOLUMN HEADER可以又有TEhow to generate table in visual C#
请问DATAGRID里的BOUNDCOLUMN HEADER可以又有TEXT又有asp.net
static or else?Add controls into web form dynamically?
intresting datagrid那个Control可以做这个事情?
相关话题的讨论汇总
话题: employee话题: name话题: datagrid话题: string话题: htmlform