Reputation: 254
Hello how can i change attributes inside a LinkButton, on button click event.
This is an example:
<asp:Label runat="server" ID="LblBarcode" Font-Bold="true"></asp:Label>
<asp:TextBox runat="server" ID="TxbBarcode"></asp:TextBox>
<asp:Label runat="server" ID="LblAltura" Font-Bold="true"></asp:Label>
<asp:TextBox runat="server" ID="TxbAltura"></asp:TextBox>
<asp:LinkButton runat="server" ID="LBPrinter" href="print://1234/TxbBarcode/TxbAltura" OnClick="LBPrinter_Click"></asp:LinkButton>
How can i do that the information that is written in the textboxes gets inserted in the href?
Upvotes: 0
Views: 256
Reputation: 1205
To handle client-side events, especially click we have an event handler onclientclick.
<asp:LinkButton runat="server" ID="LBPrinter" href="print://1234/TxbBarcode/TxbAltura" OnClick="LBPrinter_Click" onclientclick='changeLink(this)'></asp:LinkButton>
Client-Side Javascript:
function changeLink(linkButton) {
linkButton.href = "<new link>";
}
Upvotes: 1