Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Help a newbie... (DataGrid bound & template columns)

Reply
Thread Tools

Help a newbie... (DataGrid bound & template columns)

 
 
=?Utf-8?B?RGF2aWQ=?=
Guest
Posts: n/a
 
      02-07-2005
Hello,

I have a DataGrid that has a template col with an asp:LinkButton tag in it.

When the LinkButton is clicked for this row, the onClick handler needs to do
some things with some various data items from this row and eventually modify
other data items in the same row before rebinding the whole thing.

But how do I get at the data fields in the "parent row" of the LinkButton
that was clicked? What is the syntax?

Thanks,

David




 
Reply With Quote
 
 
 
 
Roy
Guest
Posts: n/a
 
      02-07-2005
OMG. I'm actually posting an "answer" to this ng...not just a question.
It's a first.

Dave, firstly, you mention using a linkbutton... Why specificly?
Linking to another page seems to imply other things going on here...

Secondly, to find out how to gain access to various specific cells in a
datagrid, research "editing a datagrid," (there are a million sites
online about it) and look for the Sub where the page is updated. This
will teach you easily.

It's not involved. Something like "E.Item.Cells(6).Controls(0)"
references the 6th cell in the currently selected record.

Something like "Dim strXYZ As String = E.Item.Cells(6).Text" declares a
string variable and sets the cell's contents to it.

 
Reply With Quote
 
 
 
 
Vadivel Kumar
Guest
Posts: n/a
 
      02-10-2005
When you use Itemtemplate to bind a control
like any literal controls, you have to
get the handle of the control by using FindControl() like this,

LinkButton l = (LinkButton) e.Item.FindControl("LinkButtonID");

This will find the control and assign it to the object l, you can do any
kind of manipulation with the l and that
will be replicated to the actual control located in
the page.

Hope, this helps you.

Thanks & Regards
Vadivel Kumar
http:\\csharpblogs.blogspot.com

"David" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I have a DataGrid that has a template col with an asp:LinkButton tag in
> it.
>
> When the LinkButton is clicked for this row, the onClick handler needs to
> do
> some things with some various data items from this row and eventually
> modify
> other data items in the same row before rebinding the whole thing.
>
> But how do I get at the data fields in the "parent row" of the LinkButton
> that was clicked? What is the syntax?
>
> Thanks,
>
> David
>
>
>
>



 
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
Lower bound & Upper bound sunil panda Java 9 10-07-2008 08:32 PM
Passing Bound Object value to another Bound Object Phillip Vong ASP .Net 0 07-27-2006 10:54 PM
How to represent the data in a not bound control via bound control Mario Krsnic ASP .Net 0 06-23-2006 07:38 AM
Getting lower-bound and upper-bound of strings input Rhiner Dan C++ 1 03-27-2005 02:03 AM
Re: A Newbie Question about template template template Chris Theis C++ 2 07-24-2003 09:42 AM



Advertisments