|
-
Jan 15th, 2008, 09:34 PM
#1
Thread Starter
Hyperactive Member
[2005] Wanting server side event for button in FormView
When I click on the button inside the formview, I get the default event for the FormView and not the button. Maybe there's no hope for this route.
Another option would be to put the button outside of the formview, but I also need access to one of the data fields from the FormView's binding to give the button custom text. How could one do this? using Eval("FieldName"), returns blank so that tells me that it's out of scope
-
Jan 16th, 2008, 05:58 AM
#2
Re: [2005] Wanting server side event for button in FormView
Give the button a CommandName/CommandArgument and you can then 'detect' it from the FormView's event.
-
Jan 17th, 2008, 01:35 AM
#3
Thread Starter
Hyperactive Member
Re: [2005] Wanting server side event for button in FormView
Can you give an example?
or Is there a way to bind the text of a button to an item from an objectdatasource?
-
Jan 17th, 2008, 07:54 AM
#4
Re: [2005] Wanting server side event for button in FormView
In your formview's template:
Code:
<asp:Button ID="btnDie" runat="server" CommandName="DIE" Text="DIE!!!" />
In the formview's ItemCommand event
Code:
Dim cmd as string
cmd = e.CommandName
If cmd = "DIE" Then
Die()
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|