Ken, thanks for responding.
I'll try to answer you both... (by posting to each response)
I expected to get a "Why do you want to do that" answer on this issue
because maybe it's impossible to do what I want to do.
I have had repeated needs on several recent jobs to provide the user with a
run time variable matrix of dataentry fields. I know that older
conventional web developers would render out an html table from their code
so the user could enter the data but this has lots of weaknesses.
I thought that a DataGrid or a GridView would be a good tool to use as I
could put it in a DIV where it could be scrolled, I could vary the matrix at
run time (4x6, 1000 x 1000, etc), and add textboxes, regularexpression
validators, etc as desired. I could even create a component using this
technique to make it easier for the developer to use. I figured it must be
possible to manually load data into a GridView since databinding somehow
does it. I see however that the Rows property is read-only.
So, that's WHY I want to do it.
BTW, I never really did this with a DataGrid either. I wrote a General
Purpose Table Maintenance Utility where I got the data in by loading up a
dataset, bound it, and then walked through the grid after the data was
changed. Maybe I'll have to take that approach here too?
Is it impossible to do what I am trying to do? Is there some beter way?
--
Regards,
Gary Blakely
--
Regards,
Gary Blakely
Dean Blakely & Associates
www.deanblakely.com
"Ken Cox [Microsoft MVP]" <> wrote in message
news:%...
> Hi Gary,
>
> Perhaps you could explain what your ultimate goal is?
>
> It looks like you're trying to use a gridview to create a table of some
> sort without binding to data. Its the data the makes the GridView add
> rows.
>
> Ken
> Microsoft MVP [ASP.NET]
>
> "GaryDean" <> wrote in message
> news:...
>> I'm trying to load a GridView up with data manually, in code. I'm not
>> using any datasource. Using this code....
>>
>> ArrayList myRowArrayList;
>> GridViewRow myGVR = new
>> GridViewRow(0,0,DataControlRowType.DataRow, DataControlRowState.Normal);
>> TableCell myCell = new TableCell();
>> TextBox myTextbox = new TextBox();
>> myTextbox.Text = "hello world";
>> myCell.Controls.Add(myTextbox);
>> myGVR.Cells.Add(myCell);
>> myRowArrayList.Add(myGVR);
>> GridViewRowCollection myCollection = new
>> GridViewRowCollection(myRowArrayList);
>> //How do I attach this collection to my GridView?
>>
>> I can't see how to add the new row I created to the GridView. There is
>> no GridView.rows.add method. How is a row added to a gridview or how is
>> the GridViewRowcollectin attached to the Gridview?
>> --
>> Regards,
>> Gary Blakely
>>
>>
>
>