Form not rendering updated label after postback - c#

I have been have problems with a postback from the button submit as after the button has finished the site think its a full refresh which gives me no chance to show any failure of login message or error,
I cant seem to pinpoint why this is happening and have looked up about the page cycle but can't put my finger on it.
Heres all my code for behind the page
protected void Page_Init(object sender, EventArgs e)
{
Session["user"] = "";
Session["domain"] = "";
Session["manager"] = "";
}
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
lblError.Text = "This was a post back.";
else
lblError.Text = "This was NOT a post back.";
}
protected void btnLogin_Click(object sender, EventArgs e)
{
//Allows the variable to be used through out the app
Session["user"] = username;
Session["domain"] = domain;
Session["manager"] = null;
if (true == authenticateUser(Session["domain"].ToString(), Session["user"].ToString(), password))
Response.Redirect(Response.ApplyAppPathModifier("Update.aspx"));
}
and front
<form id="form1" runat="server" style="Width:19%;" class="pure-form pure- form-stacked">
<asp:ScriptManager runat="server"></asp:ScriptManager>
<asp:Label ID="lblName" runat="server" Text="Name"></asp:Label>
<br />
<asp:TextBox ID="txtLoginID" Width="95%" Style="display:inline-block;" runat="server"></asp:TextBox>
</div>
<br/>
<asp:Label ID="lblpwd" runat="server" Text="Password"></asp:Label>
<asp:TextBox ID="txtPassword" Width="95%" TextMode="Password" runat="server"></asp:TextBox>
<asp:Label ID="lbldmn" runat="server" Text="Domain"></asp:Label>
<asp:DropDownList ID="ddlDomain" Width="95%" runat="server">
<asp:ListItem>hdnl.it</asp:ListItem>
<asp:ListItem>yodel.net</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="lblError" runat="server" ForeColor="Red" ></asp:Label>
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="btnLogin" runat="server" Text="Login" Width="95%" OnClick="btnLogin_Click"
CssClass="button-success pure-button" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server"
AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<div class="overlay"></div>
<div class="modal">
<h2>Please Wait.....</h2>
<img alt="Loading..." src="/Images/loading.gif" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</form>

Related

ASP Multiple UpdatePanels with gridviews but only one updating

I wish to have 3 gridviews on a single aspx page fed by individual DB queries (displaying static data, no manipulation) and based on a 10 second timer, refresh the tables. I have the code to return the datatables sorted. I can make it update one gridview which is in one of my update panels, but the other two dont render.
Code is:
<%# Page Title="Index" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Admin.aspx.cs" Inherits="Test.Admin" %>
<script runat="server" type="text/c#">
protected void Page_PreRender(object sender, EventArgs e)
{
Label1.Text = "Panel refreshed at: " + DateTime.Now.ToLongTimeString();
FullAccessSession.DataSource=GetStatus("FullAccess");
FullAccessSession.DataBind();
Label2.Text = "Panel refreshed at: " + DateTime.Now.ToLongTimeString();
LimitedAccessSession.DataSource=GetStatus("LimitedStatus");
LimitedAccessSession.DataBind();
Label3.Text = "Panel refreshed at: " + DateTime.Now.ToLongTimeString();
LogData.DataSource = GetLog() ;
LogData.DataBind();
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = "Panel refreshed at: " + DateTime.Now.ToLongTimeString();
FullAccessSession.DataSource=GetStatus("FullAccess");
FullAccessSession.DataBind();
}
protected void Timer2_Tick(object sender, EventArgs e)
{
Label3.Text = "Panel refreshed at: " + DateTime.Now.ToLongTimeString();
LogData.DataSource = GetLog() ;
LogData.DataBind();
}
protected void Timer3_Tick(object sender, EventArgs e)
{
Label2.Text = "Panel refreshed at: " + DateTime.Now.ToLongTimeString();
LimitedAccessSession.DataSource=GetStatus("LimitedStatus");
LimitedAccessSession.DataBind();
}
</script>
<div class="row">
<div class="col-md-7">
<asp:UpdatePanel ID="UpdateFullAccessStatus" runat="server" UpdateMode="Always">
<ContentTemplate>
<!--<asp:Timer ID="Timer1" runat="server" Interval="10000" OnTick="Timer1_Tick">
</asp:Timer>-->
<asp:Label ID="Label7" runat="server" Font-Bold="True" Text="Full Access Logged In Users"></asp:Label>
<br />
<asp:Label ID="Label1" runat="server" Text="Panel not refreshed yet."></asp:Label>
<br />
<asp:GridView ID="FullAccessSession" runat="server">
</asp:GridView>
<br />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdateLimitedAccessStatus" runat="server" UpdateMode="Always">
<ContentTemplate>
<!--<asp:Timer ID="Timer3" runat="server" Interval="10000" OnTick="Timer2_Tick">
</asp:Timer>-->
<asp:Label ID="Label4" runat="server" Font-Bold="True" Text="Limited Access Logged In Users"></asp:Label>
<br />
<asp:Label ID="Label2" runat="server" Text="Panel not refreshed yet."></asp:Label>
<br />
<asp:GridView ID="LimitedAccessSession" runat="server">
</asp:GridView>
<br />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdateLog" runat="server" UpdateMode="Always">
<ContentTemplate>
<!--<asp:Timer ID="Timer2" runat="server" Interval="10000" OnTick="Timer2_Tick">
</asp:Timer>-->
<asp:Label ID="Label5" runat="server" Font-Bold="True" Text="General Log"></asp:Label>
<br />
<asp:Label ID="Label3" runat="server" Text="Panel not refreshed yet."></asp:Label>
<asp:GridView ID="LogData" runat="server">
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
I cant work out why one of my update panels are working. As you can see i've tried using the PreRender function as well as (currently commented out) timers. The labels are updating with the current time but only one gridview displays.
Any help would be appreciated
Thanks
The issue here is that the script of timer is lost after the post back inside the UpdatePanel - the solution is to take it out of the update panel and use Triggers
Here is an example that I test it and works.
<asp:Timer ID="Timer1" runat="server" ontick="Timer1_Tick" Interval="2800"></asp:Timer>
<asp:Timer ID="Timer2" runat="server" ontick="Timer2_Tick" Interval="2500"></asp:Timer>
<div>
<div>
<asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" />
</Triggers>
<ContentTemplate>
<asp:Literal runat="server" ID="txtTest1"></asp:Literal>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div>
<asp:UpdatePanel runat="server" ID="UpdatePanel2" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer2" />
</Triggers>
<ContentTemplate>
<asp:Literal runat="server" ID="txtTest2"></asp:Literal>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
and on code behind the ontick is the trigger, eg:
protected void Timer1_Tick(object sender, EventArgs e)
{
txtTest1.Text += "1.";
}

UpdatePanel and panel visibility asp.net c#

I have two panels. Each panel contains an updatepanel.
The first panel is a password Textbox.
I set the second panel's visibility on page_load to false.
If the user enters the correct password, the second panel should be visible and the first panel shouldnd.
The code:
<asp:Panel ID="passwordPanel" runat="server">
<asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server">
<ContentTemplate>
Geben Sie das Passwort ein:<br />
<br />
<asp:TextBox ID="txtPassword" AutoPostBack="false" runat="server" TextMode="Password"></asp:TextBox>
<br />
<br />
<asp:Button ID="btnConfirmPassword" runat="server" AutoPostBack="true" Text="Senden" CssClass="button" OnClick="btnConfirmPassword_Click"/>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<asp:Panel ID="panelUploadDownload" runat="server">
<h2>Upload Paketformeln CSV</h2>
<input type="file" id="myFile" name="myFile" />
<asp:Button runat="server" ID="btnUpload" OnClick="btnUploadClick" CssClass="button" Text="Upload" />
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<br />
<asp:Label ID="lblStatus" runat="server" Text="statusLabel"></asp:Label>
<br />
<asp:Panel ID="panelChanges" runat="server" CssClass="pnlCSS">
<asp:Label ID="lblChangesHeader" runat="server" Font-Bold="True" ForeColor="Black" Text="Änderungen"></asp:Label>
<br />
<asp:Label ID="lblChanges" runat="server" ForeColor="#009900" Text="changes"></asp:Label>
<br />
<br />
<asp:Button ID="btnConfirm" runat="server" OnClick="btnConfirm_Click" CSSClass="button" Text="Änderungen bestätigen" />
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<br />
<br />
<br />
<h2>Download Paketformeln CSV</h2>
<p><asp:Button ID="btnDownloadCsv" runat="server" OnClick="btnDownloadCsv_Click" Text="Download CSV" CSSClass="button"/></p>
</asp:Panel>
And the C# code:
protected void btnConfirmPassword_Click(object sender, EventArgs e)
{
if (txtPassword.Text == "XX")
{
uploadDownloadPanel.Visible = true;
passwordPanel.Visible = false;
}
}
Load Event
protected void Page_Load(object sender, EventArgs e)
{
mainController = new MainController();
setStatus("", Color.Black);
lblChanges.Visible = false;
lblChangesHeader.Visible = false;
btnConfirm.Visible = false;
panelChanges.Visible = false;
panelUploadDownload.Visible = false;
}
For some reason it doesnt work. Any clues? Triggers?
The SecureString class doesn't allow you to see the value; that's the whole point of it. If you want to be able to work with the value entered into the PasswordBox, use the Password member of PasswordBox instead of the SecurePassword member:
protected void btnConfirmPassword_Click(object sender, EventArgs e)
{
if (txtPassword.Password == "XX")
{
uploadDownloadPanel.Visible = true;
passwordPanel.Visible = false;
}
}
i just removed the updatepanel from the passwordPanel and it worked.
In your load event, do the following
if(IsPostback)
{
uploadDownloadPanel.Visible = false;
}
Actually, every time when you press button, you load event also triggered
You can set your UpdateMode to Always of update panel within panelUploadDownload panel.It will work.
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Always" runat="server">

asp button doesn't invoke postback in usercontrol updatepanel

I have two asp buttons in my user control inside an update panel. But when I click them the postback is not completed (I have a java script alert set to page_load to tell me when a post back occurs, for example, it fires when the dropdownlist selection is changed). I can't figure out why the buttons are not posting back.
My usercontrol, the buttons in question are createBtn and signinBtn.
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="Login.ascx.cs" Inherits="TestApp2.Views.Login" %>
<asp:UpdatePanel ID="LoginMainUpdatePanel" runat="server" UpdateMode="Conditional" OnUnload="UpdatePanel_Unload">
<ContentTemplate>
<asp:TextBox ID="infoTB" runat="server" TextMode="MultiLine" />
<div>
<div class="left-align" style="background-color:blue">
<asp:button runat="server" id="createBtn" CssClass="btn btn-default" OnClick="createBtn_Click" Text="Create" /><br/>
<asp:button runat="server" id="signinBtn" CssClass="btn btn-default" OnClick="signinBtn_Click" Text="Sign In" />
</div>
<!-- Login View -->
<div id="loginView" runat="server" class="centre-form centering text-center" style="background-color:green">
<h1>Login</h1>
<asp:Label ID="info" runat="server" Text="" />
<div class="form-group">
<label for="userIn">Username</label>
<asp:TextBox runat="server" id="userIn" CssClass="form-control" TextMode="SingleLine" />
<asp:RequiredFieldValidator runat="server" id="reqUser" controltovalidate="userIn" errormessage="Enter Username" />
</div>
<div class="form-group">
<label for="passwordIn">Password</label>
<asp:TextBox runat="server" id="passwordIn" CssClass="form-control" Text="Enter Password" TextMode="Password" />
<asp:RequiredFieldValidator runat="server" id="reqPass" controltovalidate="passwordIn" errormessage="Enter Password" />
</div>
<asp:Button runat="server" id="loginBtn" CssClass="btn btn-default" onclick="loginBtn_Click" text="Login" />
</div>
<!-- Create Account View -->
<div id="createView" runat="server" class="centre-form centering text-center" style="background-color:green">
<h1>Create</h1>
<div class="form-horizontal">
<div class="form-group" style="background-color:yellow;">
<asp:TextBox runat="server" id="personalFName" CssClass="form-control" TextMode="SingleLine" />
<label class="control-label" for="personalFName">First Name</label>
</div>
<div class="form-group">
<asp:TextBox runat="server" id="personalLName" CssClass="form-control" TextMode="SingleLine" />
<label class="control-label" for="personalLName" >Last Name</label>
</div>
<div class="form-group">
<asp:DropDownList runat="server" id="selGender" CssClass="form-control">
<asp:ListItem Value="Male" Text="Male" />
<asp:ListItem Value="Female" Text="Female" />
<asp:ListItem Value="Other" Text="Other" />
</asp:DropDownList>
<label class="control-label" for="selGender">Gender</label>
</div>
<asp:UpdatePanel ID="dobUpdatePanel" runat="server" UpdateMode="Conditional" OnUnload="UpdatePanel_Unload">
<ContentTemplate>
<div class="form-group">
<asp:DropDownList runat="server" id="selYear" CssClass="form-control" OnSelectedIndexChanged="selYear_SelectedIndexChanged" AutoPostBack="true" />
<asp:DropDownList runat="server" id="selMonth" CssClass="form-control" OnSelectedIndexChanged="selMonth_SelectedIndexChanged" AutoPostBack="true" />
<asp:DropDownList runat="server" id="selDay" CssClass="form-control"/>
<label class="control-label" for="selDay" >Date of Birth</label>
</div>
</COntentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
The code behind is as so
public partial class Login : System.Web.UI.UserControl
{
private DateMenu dobCtrl;
protected void Page_Load(object sender, EventArgs e)
{
if (Session[Paths.USERDETAILS] != null) Response.Redirect(Paths.USERCTRL_BASE + "Profile.ascx");
else setDetails();
}
protected void loginBtn_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
String SOAPbdy = "<Username>" + userIn.Text + "</Username><Password>" + passwordIn.Text + "</Password>";
HTTPRequest req = new HTTPRequest();
String response = req.HttpSOAPRequest(SOAPbdy, "GetUser");
infoTB.Text += response;
String uIDs = (new XMLParse(response)).getElementText("UserID");
int uID = 0;
Int32.TryParse(uIDs, out uID);
if (uID > 0)
{
Session["userDetails"] = response;
info.Text = "Success";
}
else info.Text = "Login failed";
}
}
private void setDetails()
{
if (dobCtrl == null) dobCtrl = new DateMenu(selYear, selMonth, selDay);
dobCtrl.setDateDropdown();
}
protected void UpdatePanel_Unload(object sender, EventArgs e)
{
MethodInfo methodInfo = typeof(ScriptManager).GetMethods(BindingFlags.NonPublic | BindingFlags.Instance)
.Where(i => i.Name.Equals("System.Web.UI.IScriptManagerInternal.RegisterUpdatePanel")).First();
methodInfo.Invoke(ScriptManager.GetCurrent(Page),
new object[] { sender as UpdatePanel });
}
protected void selYear_SelectedIndexChanged(object sender, EventArgs e)
{
dobCtrl.fillDays();
}
protected void selMonth_SelectedIndexChanged(object sender, EventArgs e)
{
dobCtrl.fillDays();
}
protected void createBtn_Click(object sender, EventArgs e)
{
loginView.Visible = false;
}
protected void signinBtn_Click(object sender, EventArgs e)
{
}
}
I believe you have to register the controls for postback using
ScriptManager.RegisterPostbackControl()
https://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.registerpostbackcontrol%28v=vs.110%29.aspx
Try setting up the triggers for the UpdatePanel like so:
<asp:UpdatePanel ID="LoginMainUpdatePanel" runat="server" UpdateMode="Conditional" OnUnload="UpdatePanel_Unload">
<ContentTemplate>
<asp:TextBox ID="infoTB" runat="server" TextMode="MultiLine" />
<div>
<div class="left-align" style="background-color:blue">
<asp:button runat="server" id="createBtn" CssClass="btn btn-default" OnClick="createBtn_Click" Text="Create" /><br/>
<asp:button runat="server" id="signinBtn" CssClass="btn btn-default" OnClick="signinBtn_Click" Text="Sign In" />
</div>
[...]
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="createBtn" />
<asp:PostBackTrigger ControlID="signinBtn" />
</Triggers>
</asp:UpdatePanel>
Try adding PostBackTriggers for the UpdatePanel.
Add 2 triggers one for each of the buttons.
<asp:UpdatePanel ID="myUpdatePanel" runat="server" UpdateMode="Conditional"ChildrenAsTriggers="false">
<ContentTemplate>
//Your Content
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="createBtn" />
<asp:PostBackTrigger ControlID="Signbtn" />
</Triggers>
</asp:UpdatePanel>
It was because of the asp form validation, no postback (async or not) was occurring because the form wasn't valid. Removing that made it all work.

Validation stops working with hidden divs

I have created my own CRM system which works perfectly locally. However, when the project has been uploaded to our web server, I'm getting some weird errors. I'm hoping the one I'm describing here is the catalyst for the others.
There is a section that shows the next lead to call with a button to click so you can amend the lead contact details. It's a basic hide/show div toggle. I have validation on the textboxes in the "amendtext" div. However, the validation is completely ignored on the button click (I'm using a validation group). Remove the hide/show on the divs and the validation works fine.
Here's the code I'm using to arrange the divs and call the click to save event. I've edited out all the styling etc:
<div>
<div id="viewtext" runat="server">
<div class="leadaddress">
<p><strong><asp:Label ID="lblName" runat="server" Text=""></asp:Label></strong></p>
<p><asp:Label ID="lblAddress" runat="server" Text=""></asp:Label><br /></p>
</div>
<div>
<p><asp:Label ID="lblLeadTel" runat="server" Text=""></asp:Label></p>
</div>
<div class="leaddetailsbut">
<p><asp:LinkButton ID="clickToAmend" runat="server" OnClick="clickToAmend_Click">Amend Address</asp:LinkButton></p>
</div>
</div>
<div id="amendtext" runat="server">
<p>
<label>Company</label>
<asp:TextBox ID="tbLeadName" runat="server" ></asp:TextBox>
<asp:CustomValidator
ID="CustomValidatorLeadName" runat="server"
ControlToValidate="tbLeadName"
OnServerValidate="CustomValidatorLeadName_ServerValidate"
ValidateEmptyText="True"
ValidationGroup="Lead">
</asp:CustomValidator>
</p>
<p>
<label class="lblwidth80">Address 1</label>
<asp:TextBox ID="tbAddress1" runat="server" ></asp:TextBox>
<asp:CustomValidator
ID="CustomValidatorLeadAddress1" runat="server"
ControlToValidate="tbAddress1"
OnServerValidate="CustomValidatorAddress1_ServerValidate"
ValidateEmptyText="True"
ValidationGroup="Lead">
</asp:CustomValidator>
</p>
<p>
<label class="lblwidth80">Address 2</label>
<asp:TextBox ID="tbAddress2" runat="server" ></asp:TextBox>
</p>
<p>
<label class="lblwidth80">City</label>
<asp:TextBox ID="tbCity" runat="server" ></asp:TextBox>
<asp:CustomValidator
ID="CustomValidatorCity" runat="server"
ControlToValidate="tbCity"
OnServerValidate="CustomValidatorCity_ServerValidate"
ValidateEmptyText="True"
ValidationGroup="Lead">
</asp:CustomValidator>
<label>Postcode</label>
<asp:TextBox ID="tbPostcode" runat="server" ></asp:TextBox>
<asp:CustomValidator
ID="CustomValidatorPostcode" runat="server"
ControlToValidate="tbPostcode"
OnServerValidate="CustomValidatorPostcode_ServerValidate"
ValidateEmptyText="True"
ValidationGroup="Lead">
</asp:CustomValidator>
</p>
<div>
<p>
<label>Telephone</label>
<asp:TextBox ID="tbTelephone" runat="server" ></asp:TextBox>
<asp:CustomValidator
ID="CustomValidatorTelephone" runat="server"
ControlToValidate="tbTelephone"
OnServerValidate="CustomValidatorTelephone_ServerValidate"
ValidateEmptyText="True"
ValidationGroup="Lead">
</asp:CustomValidator>
</p>
</div>
<div>
<asp:LinkButton ID="clickToSave" runat="server" OnClick="clickToSave_Click" ValidationGroup="Lead">Save Address</asp:LinkButton>
</div>
</div>
</div>
Code behind:
protected void Page_Load(object sender, EventArgs e)
{
viewtext.Visible = true;
amendtext.Visible = false;
}
protected void clickToAmend_Click(object sender, EventArgs e)
{
viewtext.Visible = false;
amendtext.Visible = true;
}
protected void clcikToSave_Click(object sender, EventArgs e)
{
if (this.Page.IsValid)
{
//code to save the change...
viewtext.Visible = true;
amendtext.Visible = false;
}
}
I'm now starting to pull what little hair I have left...

Modal popup not generating postback to page

<ajaxToolkit:ModalPopupExtender runat="server"
id="ModalPopupExtender1"
cancelcontrolid="btnCancel" okcontrolid="btnOkay"
targetcontrolid="Button1" popupcontrolid="Panel1"
drag="true"
backgroundcssclass="ModalPopupBG"
/>
<asp:Button ID="Button1" runat="server" Text="Test Modal Popup"
onclick="Button1_Click" />
<br />
<asp:UpdatePanel ID="up" runat="server">
<ContentTemplate>
<asp:Button ID="Button2" runat="server" Text="Post Back"
onclick="Button2_Click" />
<asp:Label ID="Label1" runat="server" AutoPostBack="true" Text="Nothing has happened yet..."></asp:Label>
<asp:Panel ID="Panel1" runat="server" AutoPostBack="true">
<div class="HellowWorldPopup">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="btnCancel" runat="server" Text="Canel"
onclick="btnCancel_Click" />
<asp:Button ID="btnOkay" runat="server" Text="Okay" onclick="btnOkay_Click" />
</div>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
So I am trying to get the Label to have the contents of what the user typed in the textbox inside the modal popup. Right now the btnOkay is not causing this to work.
.cs file:
protected void btnCancel_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
}
protected void btnOkay_Click(object sender, EventArgs e)
{
Label1.Text = TextBox1.Text;
TextBox1.AutoPostBack = true;
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "";
TextBox1.Text = "";
}
protected void Button2_Click(object sender, EventArgs e)
{
Label1.Text = "You clicked the button";
}
I do not want the page to post back at all, but just to update the hidden labels on the page once information is entered. How do I do this?
Edit:
Alright, this should do the trick I think.
<ajax:ModalPopupExtender runat="server" id="ModalPopupExtender1" targetcontrolid="Button1"
popupcontrolid="Panel1" drag="true" backgroundcssclass="ModalPopupBG" />
<asp:Button ID="Button1" runat="server" Text="Test Modal Popup" /><br />
<asp:Panel ID="Panel1" runat="server">
<div class="HellowWorldPopup">
<asp:TextBox ID="TextBox1" runat="server" />
<asp:Button ID="btnCancel" runat="server" Text="Canel" onclick="btnCancel_Click" />
<asp:Button ID="btnOkay" runat="server" Text="Okay" onclick="btnOkay_Click" />
</div>
</asp:Panel>
<asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Nothing has happened yet..." />
</ContentTemplate>
</asp:UpdatePanel>
.
protected void btnCancel_Click(object sender, EventArgs e)
{
TextBox1.Text = "";
}
protected void btnOkay_Click(object sender, EventArgs e)
{
Label1.Text = TextBox1.Text;
up.Update();
}

Categories

Resources