hey guys, i'm new to working with .net c#. I've been doing some more advanced things without knowing much about what i'm doing... I need to create this popup window without using the javascript.. i've been mostly successfull using some simple code however my buttons on the popup don't execute. any ideas and solutions would be greatly appreciated... thank you
this is the front form... form1
[HTML]
<form id="form1" runat="server">
<div>
<asp:LinkButt on Text="userIdlin k" OnCommand="link button1" CommandArgument ="12" runat="server" />
<asp:Label Text="" ID="lblTest" runat="server"> </asp:Label>
</div>
</form>
[/HTML]
this is the codebehind
this is the front form... form1
[HTML]
<form id="form1" runat="server">
<div>
<asp:LinkButt on Text="userIdlin k" OnCommand="link button1" CommandArgument ="12" runat="server" />
<asp:Label Text="" ID="lblTest" runat="server"> </asp:Label>
</div>
</form>
[/HTML]
this is the codebehind
Code:
namespace popup { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } public void linkbutton1(object sender, EventArgs e) { string passValue = ""; passValue = ((LinkButton)sender).CommandArgument; HtmlGenericControl div = new HtmlGenericControl("div"); //div.InnerText = "Do you want to request BLAH as your friend?"; div.Attributes.Add("id","popup"); div.Attributes.Add("style", "zIndex:3; width:350px; height:150px; border: 2px solid silver; position: absolute; top: 150px; left: 150px; background:#eaeaea; padding: 15px;"); Button btnRequest = new Button(); btnRequest.ID = "btnRequest"; btnRequest.Text = "Send my request."; btnRequest.Click += new EventHandler(sendRequest); btnRequest.Attributes.Add("runat", "server"); Button btnCancel = new Button(); btnCancel.ID = "btnCancel"; btnCancel.Text = "Cancel my request."; btnCancel.Click += new EventHandler(cancelRequest); Label lblMessage = new Label(); lblMessage.ID = "lblMessage"; lblMessage.Text = "Is " + passValue + " the correct userId?<br>"; div.Controls.Add(lblMessage); div.Controls.Add(btnRequest); div.Controls.Add(btnCancel); this.form1.Controls.Add(div); } public void sendRequest(object sender, System.EventArgs e) { Response.Write("this function does nothing."); } public void cancelRequest(object sender, System.EventArgs e) { Response.Write("this function does nothing."); } } }
Comment