Last post Apr 02, 2010 05:21 AM by vgrigor4
Mar 14, 2010 05:43 AM|SATISH646|LINK
I have Gridviewand i have enable dyamic data support for it. Now i need to update multiple records in this on a single button click.
Can any one tell me how to extract the values from this gridview.
Mar 14, 2010 06:25 AM|adeelehsan|LINK
Use the following code:
for (int rows = 0; rows <= GridView1.Rows.Count - 1;rows++ )
for (int cells=0;cells<=GridView1.Rows[rows].Cells.Count-1;cells++)
//Get text of each cell like the following and process it
string s = GridView1.Rows[rows].Cells[cells].Text;
ASP .net 2. 0
Mar 19, 2010 06:19 AM|sjnaughton|LINK
Hi Satish646, how are you going to do this; are you goingnto have check boxes and select them, then click a button; or is it say like I want to update all records shown?
Mar 19, 2010 06:22 AM|sjnaughton|LINK
Hi Adeelehsan, although a good solution for standard ASP.Net this will not work for DD without some modification as the data is inside FieldTemplates so you will need to find the FieldlTemplate in the cell's controls collection and then cast it to FieldTemplateUserControl
to gain access to the template properties.
Mar 26, 2010 12:37 PM|vgrigor4|LINK
From GridView editing mode when you get control in Field template
you can fing GridView as
than iterating down over Controls.Controls.Controls... collections
you can get GridViewRow controls and concrete DynamicData controls within it,
there you can find values for whole visible table.
You can find same way LingDataSource on the page and get all data from it.
good sample of iterating over controls is provided in that sample:
just correct parent control type to <GridView>
than modify method FindDynamicControlRecursive(dependeeColumn.ColumnName)
to work within GridViewRow and you will get all data templtes, controls within them
and desired data.
but even if you find all data and update DataBase using Linq context.
than ypu will need to implement refresh of that controls with your new data,
for that I suppose will be needed to rescen all controls as described above
and set values for each updated value.
It is simple with standard ASP.NET
but with DD it seems need to make many deep research.
Apr 02, 2010 05:21 AM|vgrigor4|LINK
For my experience I can not find way to Access FormView Fields:
sometimes FormView real controls access will be critical
to implement non-trivial business logics
and there I see no any solution.
For example - parent remains editable in FormView part of ListDetail page template
Generators can help only with column existence.
Somebody see how to resolve this?
As well HideColumnIn (using custom metatable for columns
generation, code from Steve)
attribute block automatic parent selection behavior.