Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > How to know the selected row in a DataControlField

Reply
Thread Tools

How to know the selected row in a DataControlField

 
 
JamesD
Guest
Posts: n/a
 
      01-23-2007
Hi.

I'm creating a custom WebControl that extends GridView. This control
loads its columns dinamically reading from a XML configuration file.
Many columns loaded by the control may be a custom DataControlField
filled with an ImageButton.
I'm able to handle the click or the command event generated pressing
the ImageButton, directly in the DataControlField i made, but I would
need to know the corresponding row of the pressed ImageButton and i
cannot do that.

Do anyone of you know if is it possible to do that and how?

Thank you so much in advance.

Matteo

 
Reply With Quote
 
 
 
 
bhavesh
Guest
Posts: n/a
 
      01-23-2007
hi james,

just try to view source of ur page generated.

then u will come to know that how the id of image button is generated.


u can access the client id of image button in itemcommand event.

and from there u can split the client id accordingly to get the index
of row in which image button is clicked.

i had this requirement in my repeater control.

and i have achieved this successfully just today.

so u can do same for Gridview control.

try this and then tell me if u got ans.


JamesD wrote:
> Hi.
>
> I'm creating a custom WebControl that extends GridView. This control
> loads its columns dinamically reading from a XML configuration file.
> Many columns loaded by the control may be a custom DataControlField
> filled with an ImageButton.
> I'm able to handle the click or the command event generated pressing
> the ImageButton, directly in the DataControlField i made, but I would
> need to know the corresponding row of the pressed ImageButton and i
> cannot do that.
>
> Do anyone of you know if is it possible to do that and how?
>
> Thank you so much in advance.
>
> Matteo


 
Reply With Quote
 
 
 
 
JamesD
Guest
Posts: n/a
 
      01-23-2007
Hi bhavesh,

first of all thanks a lot for the fast answer.

I've tried to explore html code generated and i found out the piece of
information
you tell me about.
So I saw that client ID is a sort of $ separated format in wich i could
find the row number
hide in this code 'ct101', but i'm not sure of that.

This could help me, but i would like to spend many time yet to find a
less complex and more clear
solution.

Please, tell me if i misunderstood either what you told me or how the
client ID is composed.

Bye.

bhavesh ha scritto:

> hi james,
>
> just try to view source of ur page generated.
>
> then u will come to know that how the id of image button is generated.
>
>
> u can access the client id of image button in itemcommand event.
>
> and from there u can split the client id accordingly to get the index
> of row in which image button is clicked.
>
> i had this requirement in my repeater control.
>
> and i have achieved this successfully just today.
>
> so u can do same for Gridview control.
>
> try this and then tell me if u got ans.
>
>
> JamesD wrote:
> > Hi.
> >
> > I'm creating a custom WebControl that extends GridView. This control
> > loads its columns dinamically reading from a XML configuration file.
> > Many columns loaded by the control may be a custom DataControlField
> > filled with an ImageButton.
> > I'm able to handle the click or the command event generated pressing
> > the ImageButton, directly in the DataControlField i made, but I would
> > need to know the corresponding row of the pressed ImageButton and i
> > cannot do that.
> >
> > Do anyone of you know if is it possible to do that and how?
> >
> > Thank you so much in advance.
> >
> > Matteo


 
Reply With Quote
 
bhavesh
Guest
Posts: n/a
 
      01-24-2007
hi James,

I think ur easiest solution is

e.Item.ItemIndex

and e should be like : == > ByVal e As DataGridCommandEventArgs ---
in itemcommand event of datagrid.

after seeing ur last reply i have just performed a test on it.

and i am able to find the index of a row in which button has been
clicked.

sorry for first explaination. but it was customized requirement for me
.. thats why i had not any other way. so I tried that one for my
repeater control.

but now u can try above. i am sure u will get ur ans.

bye


On Jan 23, 9:27 pm, "JamesD" <(E-Mail Removed)> wrote:
> Hi bhavesh,
>
> first of all thanks a lot for the fast answer.
>
> I've tried to explore html code generated and i found out the piece of
> information
> you tell me about.
> So I saw that client ID is a sort of $ separated format in wich i could
> find the row number
> hide in this code 'ct101', but i'm not sure of that.
>
> This could help me, but i would like to spend many time yet to find a
> less complex and more clear
> solution.
>
> Please, tell me if i misunderstood either what you told me or how the
> client ID is composed.
>
> Bye.
>
> bhavesh ha scritto:
>
>
>
> > hi james,

>
> > just try to view source of ur page generated.

>
> > then u will come to know that how the id of image button is generated.

>
> > u can access the client id of image button in itemcommand event.

>
> > and from there u can split the client id accordingly to get the index
> > of row in which image button is clicked.

>
> > i had this requirement in my repeater control.

>
> > and i have achieved this successfully just today.

>
> > so u can do same for Gridview control.

>
> > try this and then tell me if u got ans.

>
> > JamesD wrote:
> > > Hi.

>
> > > I'm creating a custom WebControl that extends GridView. This control
> > > loads its columns dinamically reading from a XML configuration file.
> > > Many columns loaded by the control may be a custom DataControlField
> > > filled with an ImageButton.
> > > I'm able to handle the click or the command event generated pressing
> > > the ImageButton, directly in the DataControlField i made, but I would
> > > need to know the corresponding row of the pressed ImageButton and i
> > > cannot do that.

>
> > > Do anyone of you know if is it possible to do that and how?

>
> > > Thank you so much in advance.

>
> > > Matteo- Hide quoted text -- Show quoted text -


 
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
Custom Control with DataControlField Marten Engblom ASP .Net Building Controls 0 02-18-2007 06:00 PM
Want to add row under selected row of gridview ujjc001@gmail.com ASP .Net Building Controls 1 02-16-2007 07:14 PM
How to chang bgcolor of row when mouse selected a row? Charles Shao ASP .Net 1 04-18-2005 11:11 AM
How to add a new row to a datagrid with values of the selected row =?Utf-8?B?U3VyZXNo?= ASP .Net 1 11-22-2004 09:04 AM



Advertisments