|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
GridView "visible=False" data items not accessible? programatticallySo "everything" is working and this GridView and it is NOT used to update data. I'm attempting to get to the "invisible" data columns in a gridview. I can easily access the shown data by doing something like this, it works for "visible" data but no hidden columns in my gridview. For Each Row In GridView1.Rows For J = 0 To 57 testhold = Row.Cells.Item(J).Text.ToString Next Next Watch shows. J = 0, Testhold = '' <- this is whats wrong, there should be data here. J = 1, Testhold = '3.0' etc Basically any "visible" items data will show in the above loop. No "Visible = False" columns retain underneath data. (im trying to use keys without showing them to the user). Asp code ex... Supname always shows up empty (''). MonOtHrs shows the correct data. <asp:BoundField DataField="SupName" HeaderText="SupName" SortExpression="SupName" Visible="False" /> <asp:BoundField DataField="MonOtHrs" HeaderText="OT" SortExpression="MonOtHrs" </asp:BoundField> this works...
Dim key As DataKey = GridView1.DataKeys(0) For J = 0 To 57 testhold = key.Item(2).ToString (key field num 2) testhold = Row.Cells.Item(J).Text.ToString Next Hi,
I think a invisible column isn't rendered on the clientside, and hence no roundtrip for that data. So basically, yes you have to use datakeynames and the datakeys collection to make this work. Grtz, Wouter van Vugt If datakeys can't be used ?
Is it possible to get to the datarow via Dim row DataRowView = CType(GridViewRow.DataItem (selectedrow))beneath t row("FieldName") ? I tried this but dataitem is Nothing ... In DataRowBound event is it possible to get to all the datafields in the dataset via the dataitem. Show quoteHide quote "Wouter van Vugt" wrote: > Hi, > > I think a invisible column isn't rendered on the clientside, and hence > no roundtrip for that data. So basically, yes you have to use > datakeynames and the datakeys collection to make this work. > > Grtz, Wouter van Vugt > > Hi,
data source items & fields aren't stored with the GridView to ViewState (DataKeys being clear exception), so DataItem property is actually only accessible during the same sequence after the GridView has been bound (in practise in RowCreated and RowDataBound events raised after call to DataBind). Show quoteHide quote "Edo den Haring" <EdodenHar***@discussions.microsoft.com> wrote in message news:A77A9051-6B21-4E8A-BD3C-AD2AB66F1774@microsoft.com... > If datakeys can't be used ? > > Is it possible to get to the datarow via > Dim row DataRowView = CType(GridViewRow.DataItem (selectedrow))beneath t > row("FieldName") ? > > I tried this but dataitem is Nothing ... > > In DataRowBound event is it possible to get to all the datafields in the > dataset via the dataitem. > > "Wouter van Vugt" wrote: > >> Hi, >> >> I think a invisible column isn't rendered on the clientside, and hence >> no roundtrip for that data. So basically, yes you have to use >> datakeynames and the datakeys collection to make this work. >> >> Grtz, Wouter van Vugt >> >> Hi,
Thanx ... I was afraid for this ... :) I tried to get the current record data into my own object after selection (using the select button) via the databoundrecord event. Using row.rowtype = datarow and row.rowstate = select I tried to isolate the record be selected. It did not work ... I seems that not each select click (using the select button) the datarowbound event is fired ... Is this correct ? Greetz, Edo Show quoteHide quote "Teemu Keiski" wrote: > Hi, > > data source items & fields aren't stored with the GridView to ViewState > (DataKeys being clear exception), so DataItem property is actually only > accessible during the same sequence after the GridView has been bound (in > practise in RowCreated and RowDataBound events raised after call to > DataBind). > > -- > Teemu Keiski > ASP.NET MVP, AspInsider > Finland, EU > http://blogs.aspadvice.com/joteke > > > "Edo den Haring" <EdodenHar***@discussions.microsoft.com> wrote in message > news:A77A9051-6B21-4E8A-BD3C-AD2AB66F1774@microsoft.com... > > If datakeys can't be used ? > > > > Is it possible to get to the datarow via > > Dim row DataRowView = CType(GridViewRow.DataItem (selectedrow))beneath t > > row("FieldName") ? > > > > I tried this but dataitem is Nothing ... > > > > In DataRowBound event is it possible to get to all the datafields in the > > dataset via the dataitem. > > > > "Wouter van Vugt" wrote: > > > >> Hi, > >> > >> I think a invisible column isn't rendered on the clientside, and hence > >> no roundtrip for that data. So basically, yes you have to use > >> datakeynames and the datakeys collection to make this work. > >> > >> Grtz, Wouter van Vugt > >> > >> > > >
Inheriting from the TreeNode class
detailsview, CreateChildControls() always returns default property values Enabling/diusabling child controls Input fields are renamed with runat="server", how do I change it Website on a website. Set visibility of label in itemtemplate of repeater control VS 2005 Validator controls button's OnClick event runs after page databinding... Reading a public variable from a web user control |
|||||||||||||||||||||||