B
Bart Van Hemelen
Here's what I'm trying to accomplish: I get a number from another page
that indicates the number of members.
The page I want to build -- actually it's not a page, but a UserControl
-- needs to display a form with several types of input fields for each
of those members: regular text fields, a dropdown and Infragistics'
WebDateChooser.
The point is that someone inputs thinsg like name, date of birth etc
for each of the members, which is then submitted to the database.
I was thinking of constructing a DataSet and binding that with a
DataGrid, like this:
--ASCX----------------------------------------------------------------
<aspataGrid ID="dgMemberList" Runat="server"
Width="100%"></aspataGrid>
--CODE-BEHIND---------------------------------------------------------
DataTable oDT = new DataTable( "MLDT" );
oDT.Columns.Add( "LastName" , typeof( System.String ) );
oDT.Columns.Add( "FirstName" , typeof( System.String ) );
oDT.Columns.Add( "DateOfBirth" , typeof( System.DateTime ) );
oDT.Columns.Add( "Nationality" , typeof( System.Int32 ) );
oDT.Columns.Add( "Gender" , typeof( System.String ) );
for ( int i = 1 ; i <= iNumberOfMembers ; i++ )
{
DataRow oDataRow;
oDataRow = oDT.NewRow();
oDT.Rows.Add( oDataRow );
}
DataSet oDS = new DataSet( "MLDS" );
oDS.Tables.Add( oDT );
dgMemberList.DataSource = oDS;
dgMemberList.DataMember = "MLDT";
dgMemberList.DataBind();
--END-----------------------------------------------------------------
And then adding the controls, of course. Plus: I also need to check
what they input, preferably via RequiredFieldValidator and the likes.
But I'm now wondering about the wisdom of that decision, partly since
I'm kinda stuck at the moment. Does anybody have a better idea?
(FYI: This is all in asp.net/c#, made with VisualStudio.NET.)
that indicates the number of members.
The page I want to build -- actually it's not a page, but a UserControl
-- needs to display a form with several types of input fields for each
of those members: regular text fields, a dropdown and Infragistics'
WebDateChooser.
The point is that someone inputs thinsg like name, date of birth etc
for each of the members, which is then submitted to the database.
I was thinking of constructing a DataSet and binding that with a
DataGrid, like this:
--ASCX----------------------------------------------------------------
<aspataGrid ID="dgMemberList" Runat="server"
Width="100%"></aspataGrid>
--CODE-BEHIND---------------------------------------------------------
DataTable oDT = new DataTable( "MLDT" );
oDT.Columns.Add( "LastName" , typeof( System.String ) );
oDT.Columns.Add( "FirstName" , typeof( System.String ) );
oDT.Columns.Add( "DateOfBirth" , typeof( System.DateTime ) );
oDT.Columns.Add( "Nationality" , typeof( System.Int32 ) );
oDT.Columns.Add( "Gender" , typeof( System.String ) );
for ( int i = 1 ; i <= iNumberOfMembers ; i++ )
{
DataRow oDataRow;
oDataRow = oDT.NewRow();
oDT.Rows.Add( oDataRow );
}
DataSet oDS = new DataSet( "MLDS" );
oDS.Tables.Add( oDT );
dgMemberList.DataSource = oDS;
dgMemberList.DataMember = "MLDT";
dgMemberList.DataBind();
--END-----------------------------------------------------------------
And then adding the controls, of course. Plus: I also need to check
what they input, preferably via RequiredFieldValidator and the likes.
But I'm now wondering about the wisdom of that decision, partly since
I'm kinda stuck at the moment. Does anybody have a better idea?
(FYI: This is all in asp.net/c#, made with VisualStudio.NET.)