Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to get more data from a gridview's underlying datasource?

Reply
Thread Tools

How to get more data from a gridview's underlying datasource?

 
 
Curious Trigger
Guest
Posts: n/a
 
      07-23-2006
Hi there,

I have got a gridview showing a display-name of a person and keeping its
person-id as value accessible.

Now I am wondering how I can get to his age, if this field isn't visible in
the gridview but definied in the underlying datasource (a dataset)?

Has anyone got a idea on this problem?

Thank you for your quick answers!

Sincerly yours,
Curious SQL-Trigger


 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      07-23-2006
The grid items (row) have property DataItem. You need to typecast it to the
type representing a row in your datasource.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"Curious Trigger" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi there,
>
> I have got a gridview showing a display-name of a person and keeping its
> person-id as value accessible.
>
> Now I am wondering how I can get to his age, if this field isn't visible
> in the gridview but definied in the underlying datasource (a dataset)?
>
> Has anyone got a idea on this problem?
>
> Thank you for your quick answers!
>
> Sincerly yours,
> Curious SQL-Trigger
>



 
Reply With Quote
 
 
 
 
Curious Trigger
Guest
Posts: n/a
 
      07-23-2006
Eliyahu, thanks a lot for this tipp. I will give it a try and tell you the
outcoming.

Curious Trigger

"Eliyahu Goldin" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed)...
> The grid items (row) have property DataItem. You need to typecast it to
> the type representing a row in your datasource.
> --
> Eliyahu Goldin,
> Software Developer & Consultant
> Microsoft MVP [ASP.NET]
>
> "Curious Trigger" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi there,
>>
>> I have got a gridview showing a display-name of a person and keeping its
>> person-id as value accessible.
>>
>> Now I am wondering how I can get to his age, if this field isn't visible
>> in the gridview but definied in the underlying datasource (a dataset)?
>>
>> Has anyone got a idea on this problem?
>>
>> Thank you for your quick answers!
>>
>> Sincerly yours,
>> Curious SQL-Trigger
>>

>
>



 
Reply With Quote
 
Greg9Strat
Guest
Posts: n/a
 
      07-24-2006
There's a couple of ways you can add this. I assume you are using some
version of Visual Studio 2005/Express... In the designer, the smart
tag/menu has an "Edit Items" command that will open a new window and
you can add the item there (add a BoundField). In the properties, put
the column name from your query into the "DataTextField" property.
This is the easiest of methods...

If you are more comfortable with the code or are not using an IDE like
VS 2005, then locate the control in your source and add the following
to <asp:GridView> - <Columns>

<asp:BoundField DataField="data_age" HeaderText="Age"
SortExpression="data_age"/>

Replace 'data_age' with whatever your query is returning.

Curious Trigger wrote:
> Hi there,
>
> I have got a gridview showing a display-name of a person and keeping its
> person-id as value accessible.
>
> Now I am wondering how I can get to his age, if this field isn't visible in
> the gridview but definied in the underlying datasource (a dataset)?
>
> Has anyone got a idea on this problem?
>
> Thank you for your quick answers!
>
> Sincerly yours,
> Curious SQL-Trigger


 
Reply With Quote
 
Curious Trigger
Guest
Posts: n/a
 
      07-24-2006
Thanks for this info!

What I am searching for is how I can get to a column of a gridview, if this
column is defined in the underlying datasource but in the gridview it is
invisible. It is strange that I am not able to access this invisible piece
of information; at least not through the gridview. I have still to test the
advice of Mr. Goldin: getting the actual datarow of the underlying
datasource sounds very reasonable for me.

Yours Curious Trigger

"Greg9Strat" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed) ps.com...
> There's a couple of ways you can add this. I assume you are using some
> version of Visual Studio 2005/Express... In the designer, the smart
> tag/menu has an "Edit Items" command that will open a new window and
> you can add the item there (add a BoundField). In the properties, put
> the column name from your query into the "DataTextField" property.
> This is the easiest of methods...
>
> If you are more comfortable with the code or are not using an IDE like
> VS 2005, then locate the control in your source and add the following
> to <asp:GridView> - <Columns>
>
> <asp:BoundField DataField="data_age" HeaderText="Age"
> SortExpression="data_age"/>
>
> Replace 'data_age' with whatever your query is returning.
>
> Curious Trigger wrote:
>> Hi there,
>>
>> I have got a gridview showing a display-name of a person and keeping its
>> person-id as value accessible.
>>
>> Now I am wondering how I can get to his age, if this field isn't visible
>> in
>> the gridview but definied in the underlying datasource (a dataset)?
>>
>> Has anyone got a idea on this problem?
>>
>> Thank you for your quick answers!
>>
>> Sincerly yours,
>> Curious SQL-Trigger

>



 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to get underlying data of TreeView control? (ASP.NET 2.0) placek ASP .Net Web Controls 6 03-30-2006 10:04 AM
ObjectDataSource's underlying data/schema =?Utf-8?B?RGljaw==?= ASP .Net 2 03-01-2006 08:26 AM
how to get to the underlying data in a datagrid control? djc ASP .Net Datagrid Control 2 12-17-2004 02:11 PM
How do I use two different class interfaces to the same underlying data? velthuijsen C++ 2 11-18-2004 08:03 AM



Advertisments