Web Form Button and Link Button in DataGrid
Hi,
i basically there is a problem in my DataGrid.
i insert a button with command name "book" as in book room for e.g
but then when i item command it with e.command = "book", it wont response.redirect to the place i want
BUT
when i use a LinkButton in the DataGrid with SAME commandname "book" and the item command, it will response.redirect to what i want.
So what is going wrong with the DataGrid when i use web form button and a link button in the DataGrid.
If i insist of using web Form button, how do i go about doing it?
sorry to urge you guys, but if you all could reply me asap, i will be glad to hear you all, thanks
zkold
what do you mean by web form button?
<asp:button?
Its not the id that matters, its the event it calls, make sure it is calling the event with the response.redirect.
Yes the button.
For both LinkButton and Button, i put their commandname as "book" in DataGrid.
As for the LinkButton, it successfully response.redirect to the page i want
BUT
for the Button, it didnt. Somehow it load the same page again.
Cos i dont get it when the command name is the same,
Why does LinkButton can work and why not Button?
if i wanna use Button, how do i go about doing it?
------------------------------------------------------------------
If e.CommandName = "Book" Then
If LblGuestName.Text = "" Then
Response.Redirect("./GuestRegister.aspx")
Else
Response.Redirect("./ReservationConfirmation.aspx")
End If
End If
------------------------------------------------------------------
zkold.
Code:
<asp:button
id="butOK"
text=" OK "
Type="Submit"
OnClick="SubmitBtn_Click"
runat="server"
/>
Look at the onclick attribute. Make sure both of them have the same event fireing on click. Is the event even fireing when the button is clicked. The id does not matter really, just so long as you click it and the event gets fired.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
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
Bookmarks