Showing posts with label columns. Show all posts
Showing posts with label columns. Show all posts

Thursday, March 29, 2012

Newbie : Gridview question

Hi all,
I have a gridview on my page and templatecolumns defined in it. I also have
a couple of databound columns. The datatable being bound to the gridview
contains a column (defined as a datacolumn so as to get the value) and in
the ItemDataBound I can access this value but only when the databound
column's visibility is set to true. If I hide the visibility at design-time
I can't get access to the value at run-time. I don't want to show this
column.
How do I go about geting the value so as to do someting with it but not show
the databound column?
Regards
John.Hi John,
You can put these values in DataKeyNames, and retrieve by
.DataKeys[row_index].Values[col_index]
HTH
Elton Wang
"John" wrote:

> Hi all,
> I have a gridview on my page and templatecolumns defined in it. I also hav
e
> a couple of databound columns. The datatable being bound to the gridview
> contains a column (defined as a datacolumn so as to get the value) and in
> the ItemDataBound I can access this value but only when the databound
> column's visibility is set to true. If I hide the visibility at design-tim
e
> I can't get access to the value at run-time. I don't want to show this
> column.
> How do I go about geting the value so as to do someting with it but not sh
ow
> the databound column?
> Regards
> John.
>
>

Newbie : Gridview question

Hi all,

I have a gridview on my page and templatecolumns defined in it. I also have
a couple of databound columns. The datatable being bound to the gridview
contains a column (defined as a datacolumn so as to get the value) and in
the ItemDataBound I can access this value but only when the databound
column's visibility is set to true. If I hide the visibility at design-time
I can't get access to the value at run-time. I don't want to show this
column.

How do I go about geting the value so as to do someting with it but not show
the databound column?

Regards
John.Hi John,

You can put these values in DataKeyNames, and retrieve by

..DataKeys[row_index].Values[col_index]

HTH

Elton Wang

"John" wrote:

> Hi all,
> I have a gridview on my page and templatecolumns defined in it. I also have
> a couple of databound columns. The datatable being bound to the gridview
> contains a column (defined as a datacolumn so as to get the value) and in
> the ItemDataBound I can access this value but only when the databound
> column's visibility is set to true. If I hide the visibility at design-time
> I can't get access to the value at run-time. I don't want to show this
> column.
> How do I go about geting the value so as to do someting with it but not show
> the databound column?
> Regards
> John.
>

Saturday, March 24, 2012

Newbie Grid Question

Let me explain my situation ...
I have a grid with databound columns, which are filled at run time. I
need to add an onlick event to the link button header that will fire a
vb.net sub procedure. This sub procedure will need to be passed the
data field name which is used to fill the column clicked. The data
fields and link button header names are all determined and filled at
run time.
I want to add the onclick event by calling the attributes.add method
when the column is created. My question is, where do I put this
attributes.add method where I will have access to the data field
name? I dont want to do it on the row created event and I dont think
i have access to the columns in the grid databound event. Can anyone
point me in the right direction? I think I may be doing this
incorrectly.
Thanks so muchOn Feb 27, 1:12 pm, "mianiro" <mian...@.gmail.com> wrote:
> Let me explain my situation ...
> I have a grid with databound columns, which are filled at run time. I
> need to add an onlick event to the link button header that will fire a
> vb.net sub procedure. This sub procedure will need to be passed the
> data field name which is used to fill the column clicked. The data
> fields and link button header names are all determined and filled at
> run time.
> I want to add the onclick event by calling the attributes.add method
> when the column is created. My question is, where do I put this
> attributes.add method where I will have access to the data field
> name? I dont want to do it on the row created event and I dont think
> i have access to the columns in the grid databound event. Can anyone
> point me in the right direction? I think I may be doing this
> incorrectly.
> Thanks so much
Ok, so i figued out where to put it. My problem now is how can i get
the data field name used to populate that column'
grid.columns(0).'

Newbie Grid Question

Let me explain my situation ...

I have a grid with databound columns, which are filled at run time. I
need to add an onlick event to the link button header that will fire a
vb.net sub procedure. This sub procedure will need to be passed the
data field name which is used to fill the column clicked. The data
fields and link button header names are all determined and filled at
run time.

I want to add the onclick event by calling the attributes.add method
when the column is created. My question is, where do I put this
attributes.add method where I will have access to the data field
name? I dont want to do it on the row created event and I dont think
i have access to the columns in the grid databound event. Can anyone
point me in the right direction? I think I may be doing this
incorrectly.

Thanks so muchOn Feb 27, 1:12 pm, "mianiro" <mian...@.gmail.comwrote:

Quote:

Originally Posted by

Let me explain my situation ...
>
I have a grid with databound columns, which are filled at run time. I
need to add an onlick event to the link button header that will fire a
vb.net sub procedure. This sub procedure will need to be passed the
data field name which is used to fill the column clicked. The data
fields and link button header names are all determined and filled at
run time.
>
I want to add the onclick event by calling the attributes.add method
when the column is created. My question is, where do I put this
attributes.add method where I will have access to the data field
name? I dont want to do it on the row created event and I dont think
i have access to the columns in the grid databound event. Can anyone
point me in the right direction? I think I may be doing this
incorrectly.
>
Thanks so much


Ok, so i figued out where to put it. My problem now is how can i get
the data field name used to populate that column??
grid.columns(0).??