LinkButton and PopUps

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an interesting problem.

I have a link button on a webpage with VB as code behind.

When the user clicks on the link button I have to
1. Save the record
2. Popup a window for the user to add some extra information

Can I do both the jobs on LinkButton Click event? If I can then How???

Thanks in advance...
 
Hi Guru,

How about injecting some client-side script to open the secondary window?
You can do that during the click of the link button.

Here's the idea in the code below.

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Label1.Text = "Save to database here"
ClientScript.RegisterStartupScript(Me.GetType, "pop",
"window.open('popwin.aspx')", True)
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:linkbutton id="LinkButton1" runat="server"
onclick="LinkButton1_Click">LinkButton</asp:linkbutton><br />
<br />
<asp:label id="Label1" runat="server" text="Label"></asp:label><br
/>
<br />
</form>
</body>
</html>
 
Guru,

Why would you use the clasic way with a popup window and not an approach by
a panel for this?
The last is very easy to handle in aspnet bot 1.x and 2.0.

Cor
 
The program already has heaps of panels. It is already getting very hard to
align and display data properly on the webpage.

Ken's code worked. So atleast in that area it is working fine.

Thanks.
 
Back
Top