Click to See Complete Forum and Search --> : button on click for aspx


mohlamia
04-21-2003, 07:08 AM
Dear All,

I have a problem with adding an onclick action to an aspx.
I am using asp.net in VB and want to add a Client-side redirection to another page when the user clicks on a button. I have tried several ways like

<asp:Button id="Button1" style="Z-INDEX: 107; LEFT: 276px; POSITION: absolute; TOP: 202px" onclick="<%# response.redirect("ListCompany.aspx")%>" Font-Size="XX-Small" Font-Names="Verdana" BackColor="LightSlateGray" ForeColor="White" Height="24px" Width="279px" Text="Company List" BorderStyle="Outset" BorderColor="White" Visible="true"></asp:Button>

and like ...same code above and onclick="document.location = 'search.aspx'"

and like...same code above and onclick="search.aspx"

All of these returns an error....anyone have any idea,
Thanks in advance,

Ribeyed
04-21-2003, 07:26 AM
hi,
i am new to asp.net as well so this is only what i have seen and done so far. You need to forget using any Javascript you don't need it at all, throw it in the bin.
Try something like this:

<script runat="server">

sub redirect_click
response.redirect("ListCompany.aspx")
end sub

</script>

<asp:Button id="Button1" style="Z-INDEX: 107; LEFT: 276px; POSITION: absolute; TOP: 202px" onclick="redirect_click" Font-Size="XX-Small" Font-Names="Verdana"
BackColor="LightSlateGray" ForeColor="White" Height="24px" Width="279px" Text="Company List" BorderStyle="Outset" BorderColor="White" Visible="true" runat="server"></asp:Button>


You also need to remeber to add the runat="server" to all controls.