Click to See Complete Forum and Search --> : Web Form Button and Link Button in DataGrid


[z]`KoLd
09-26-2004, 03:47 PM
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

PeOfEo
09-26-2004, 07:30 PM
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.

[z]`KoLd
09-26-2004, 08:45 PM
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.

PeOfEo
09-26-2004, 10:38 PM
<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.