Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Button click event

Reply
Thread Tools

Button click event

 
 
James Page
Guest
Posts: n/a
 
      01-19-2010
Hi all

Have a problem setting a button’s click event.

The button is in a DetailsView row which is nested within a Gridview.
I need to set its click event to pass a value held in a label within the
same row and pass that value to a function.

I have no problems referencing the controls using:

Dim id as string
Dim dl As DataList = row.FindControl("DataList1")
For Each l As DataListItem In dl.Items
Dim ctlBtn As Button = l.FindControl("btn1")
Dim ctlLbl As Label = l.FindControl("label1")
id = ctlLbl.Text
Next

But how do i set the click event and do somthing meaningful with the code??

Any ideas?


Thanks

 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      01-19-2010
On Jan 19, 7:37*pm, James Page <(E-Mail Removed)>
wrote:
> Hi all
>
> Have a problem setting a buttons click event.
>
> The button is in a DetailsView row which is nested within a Gridview.
> I need to set its click event to pass a value held in a label within the
> same row and pass that value to a function.
>
> I have no problems referencing the controls using:
>
> Dim id as string
> Dim dl As DataList = row.FindControl("DataList1")
> For Each l As DataListItem In dl.Items
> Dim ctlBtn As Button = l.FindControl("btn1")
> Dim ctlLbl As Label = l.FindControl("label1")
> id = ctlLbl.Text
> Next
>
> But how do i set the click event and do somthing meaningful with the code??
>
> Any ideas?
>
> Thanks


Hi James,

Use EventHandler to register the event-handling method
http://msdn.microsoft.com/en-us/libr...ton.click.aspx

Hope this helps
 
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
image button click event fires before click event of button Purvi T ASP .Net 0 10-19-2004 06:19 AM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net Building Controls 1 05-28-2004 06:23 AM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net 2 05-25-2004 11:45 PM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net Datagrid Control 0 05-25-2004 01:45 AM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net Web Controls 0 05-25-2004 01:45 AM



Advertisments