Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > GridView "visible=False" data items not accessible? programattically

Reply
Thread Tools

GridView "visible=False" data items not accessible? programattically

 
 
ohyeahgo
Guest
Posts: n/a
 
      01-16-2006
this might be an easy one.

So "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>

 
Reply With Quote
 
 
 
 
ohyeahgo
Guest
Posts: n/a
 
      01-16-2006
is using data key names the only way ?

 
Reply With Quote
 
 
 
 
ohyeahgo
Guest
Posts: n/a
 
      01-16-2006
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

 
Reply With Quote
 
Wouter van Vugt
Guest
Posts: n/a
 
      01-17-2006
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

 
Reply With Quote
 
Edo den Haring
Guest
Posts: n/a
 
      03-31-2006
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
>
>

 
Reply With Quote
 
Teemu Keiski
Guest
Posts: n/a
 
      03-31-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>>
>>



 
Reply With Quote
 
Edo den Haring
Guest
Posts: n/a
 
      04-03-2006
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


"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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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
> >>
> >>

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= ASP .Net 1 05-09-2006 06:48 PM
Programattically control WebPartManager outside of ASP Page? =?Utf-8?B?Q0JyZXRhbmE=?= ASP .Net 0 11-16-2005 03:31 PM
Programattically Configure Wireless Settings.. Jose Valle Wireless Networking 2 03-31-2005 02:11 AM
Items in Outbox not moving to Sent Items Ben Lord Computer Support 0 10-23-2003 08:47 AM
grouping items among a list according to items subtag value Gilles Kuhn XML 0 09-15-2003 12:01 PM



Advertisments