Showing posts with label modalpopupextender. Show all posts
Showing posts with label modalpopupextender. Show all posts

Saturday, March 24, 2012

How do execute a server-side click event for a ModalPopupExtender?

I have created a modal popup to show up during page load. It is my logon dialog box. Anyways, I have set the OkControl property to my logon button to execute some codes through the ModalPopupExtender control staticly and dynamically through Page_Load but both didn't work..

What is my problem?

Thanks!

Ok, I follow the flow from this person website.http://blogs.vertigosoftware.com/alanl/archive/2006/07/25/Creating_a_Confirmation_Using_the_ModalPopup_Extender.aspx It works with a button.

I want to use the SHOW event when the page load but it doesn't work. It seem like it is not rendering the javascript or couldn't find it.

What is my problem?


Hi,

Have you tried this link?

http://blogs.msdn.com/phaniraj/archive/2007/02/20/show-and-hide-modalpopupextender-from-javascript.aspx

Wednesday, March 21, 2012

How can I get this ModalPopupExtender to work with Master Pages?

Here's some pretty simple code that displays a modal pop-up when a button is pressed:

1<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="5_UpdateProgModal.aspx.cs" Inherits="_5_UpdateProgModal" %>23<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4<html xmlns="http://www.w3.org/1999/xhtml">
5<head runat="server">
6 <title>ASP.Net AJAX 201</title>
7 <style type="text/css">
8 .error{color: #f00;}
9 .message{color: #000;}
10 .updating{margin: 12px;}
11 .modalBackground
12 {
13 background-color:#00f;
14 filter:alpha(opacity=40);
15 opacity:0.40;
16 }
17 .updateProgress
18 {
19 border: solid 1px #333;
20 background-color:#fff;
21 position:absolute;
22 text-align: center;
23 width:160px;
24 height:60px;
25 }
26 .updateProgressMessage
27 {
28 margin:3px;
29 vertical-align: middle;
30 }
31 </style>
32</head>
33<body>
34 <form id="form1" runat="server">
35 <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="3" />
36 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
37 <ContentTemplate>
38 <div>
39 <asp:Button ID="btnShowTime" runat="server" Text="Show Time" OnClick="btnShowTime_Click" />
40 <asp:Button ID="btnError" runat="server" Text="Throw Error" OnClick="btnError_Click" />
41 <asp:Button ID="btnTimeout" runat="server" Text="Timeout" OnClick="btnTimeout_Click" />
42 </div>
43 <div>
44 <asp:Label ID="lblMessage" runat="server" Text="Label"></asp:Label>
45 </div>
46 </ContentTemplate>
47 </asp:UpdatePanel>
48 <asp:Panel ID="pnlProg" runat="server" CssClass="updateProgress" style="display:none">
49 <div class="updating">
50 <img src="images/ajax-loader.gif" alt="Processing..." />
51 <span class="updateProgressMessage">Processing...</span>
52 </div>
53 </asp:Panel>
54 <AjaxToolkit:ModalPopupExtender
55 ID="mdlProgress"
56 runat="server"
57 TargetControlID="pnlProg"
58 PopupControlID="pnlProg"
59 BackgroundCssClass="modalBackground"/>
60 </form>
61 <script type="text/javascript">
62 var prm = Sys.WebForms.PageRequestManager.getInstance();
63 prm.add_beginRequest(beginRequest);
64 prm.add_endRequest(endRequest);
65
66 function beginRequest(sender, args)
67 {
68 $find("mdlProgress").show();
69 }
70
71 function endRequest(sender, args)
72 {
73 $find("mdlProgress").hide();
74
75 var messageSpan = $get("<%= lblMessage.ClientID%>");
76 if (args.get_error() != undefined)
77 {
78 var errorMessage = args.get_error().message;
79 if (args.get_error() && args.get_error().name === 'Sys.WebForms.PageRequestManagerTimeoutException') {
80 errorMessage = "Your operation has timed out.";
81 }
82 args.set_errorHandled(true);
83 messageSpan.className = "error";
84 messageSpan.innerHTML = errorMessage;
85 }
86 }
87 </script>
88</body>
89</html>
90

The code behind for the buttons just does a Threading.Sleep() for testing purposes so I'm not going to bother posting that code.

The problem is, I want to use this in a master page... However, when I put all this code in my master page, it doesn't work. I end up getting Javascript errors that I can't figure out. Any ideas as to why the above code works perfect yet won't work in a master page?

Hi,

Change

$find("mdlProgress")

to:

$find("<%=mdlProgress.ClientID%>")

Then, no matter master page or page, it works!

Best Regards,


The code posted by you is simple and handy and I like its simplicity for quick trials..


That was it.

I figured it was my lack of Javascript knowledge. :) Thanks so much!

How Can i get the new values from PopupWindow using Atlas ModalPopupExtender

Hi Friends,

I have completed the part of getting values from gridView and show the values in popupwindow using Atlas ModalPopupExtender.But now my requirement is

i need to edit the values in PopupWindow Textbox.if i edit the values i need to get that new Value.But I cant get it.Pls tell me how can i solve this Problem

Here is my code :

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" EnableEventValidation="false"%>
<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc2" %>
<%@dotnet.itags.org. Register Assembly="AtlasControlToolkit" Namespace="AtlasControlToolkit" TagPrefix="cc1"%>
<%@dotnet.itags.org. Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="http://links.10026.com/?link=format.css" rel="stylesheet" type="text/css" />
<link href="http://links.10026.com/?link=default.css" rel="stylesheet" type="text/css" />
<link href="http://links.10026.com/?link=ModalDialogs.css" rel="Stylesheet" type="text/css" />


<title>Untitled Page</title>
<script type="text/javascript">
var clientid;
function fnSetFocus(txtClientId)
{
clientid=txtClientId;
setTimeout("fnFocus()",1000);

}
function fnFocus()
{
eval("document.getElementById('"+clientid+"').focus()");
}
function fnClickOK(sender, e) {
__doPostBack(sender,e);
}
function PopupOrder()
{
setInterval('Popup()', 0);

}



function Popup(str)
{
flag = document.getElementById('hidOrderFlag');
if (flag)
{
if (flag.value == '1')
{
document.getElementById('btnhiddenemployee').click();
flag.value = '0';
}
}
}
</script>

</head>

<body bgcolor="#ebf7fe" style="text-align: center">
<form id="form1" runat="server">
<div>
<atlas:ScriptManager ID="atl" EnablePartialRendering="true" runat="server">
</atlas:ScriptManager>

<div runat="server" id="testdiv" style="text-align: center">
</div>

<atlas:UpdatePanel ID="upd" runat="server" Mode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Enter Last Name to search" Font-Bold =True ForeColor="MidnightBlue"></asp:Label>
:
<asp:TextBox ID="TextBox1" OnTextChanged = "TextBox1_TextChanged" AutoPostBack =true runat="server" Height="20px"
Width="150px" BorderStyle="Solid" Font-Bold="False"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="Enter KeyWord"></asp:RequiredFieldValidator>

<br />
<asp:GridView ID="GridView1" runat="server" GridLines="None" OnPageIndexChanging="GridView1_PageIndexChanging" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333">
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:ImageButton ID="btnEdit" ImageUrl="~/images/Calendar.png" CausesValidation="false" runat="server" OnCommand="CommandButton_OnSelect" OnClientClick="javascript:PopupOrder(); return true;"/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="empID" HeaderText="EmpID" />
<asp:BoundField DataField="firstname" HeaderText="FirstName" />
<asp:BoundField DataField="lastname" HeaderText="LastName" />
<asp:BoundField DataField="social" HeaderText="Social" />
<asp:BoundField DataField="department" HeaderText="Department" />
<asp:BoundField DataField="addres" HeaderText="Address" />
<asp:BoundField DataField="phone" HeaderText="Phone" />
<asp:BoundField DataField="appdate" HeaderText="AppDate" />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />

</asp:GridView>

</ContentTemplate>
</atlas:UpdatePanel>
<!--cheesy button for the modal popups target control-->



<asp:Panel ID="pnlEmployee" runat="server" CssClass="modalBox" Style="display:none" Width="300px">

<asp:Panel ID="EmployeeCaption" runat="server" CssClass="caption" Style="margin-bottom: 10px; cursor: hand;">
Edit Employee</asp:Panel>
<atlas:UpdatePanel ID="UpdatePopup" runat="server" Mode="Always">
<ContentTemplate>

<asp:HiddenField ID="hidEmployeeEditIndex" runat="server" Value="-1" />

<div>First Name</div><div> <asp:TextBox ID="txtFirstName" runat="server" AutoCompleteType="FirstName" MaxLength="64" Width="250"></asp:TextBox></div>

<div>Last Name</div><div><asp:TextBox ID="txtLastName" runat="server" AutoCompleteType="lastname" MaxLength="64" Width="250"></asp:TextBox></div>


<div>Social</div> <div><asp:TextBox ID="txtsocial" runat="server" MaxLength="64" Width="250"></asp:TextBox></div>


<div>Department</div><div><asp:TextBox ID="txtdepartment" runat="server" MaxLength="64" Width="250" AutoCompleteType="Department"></asp:TextBox></div>

<div>Address</div><div><asp:TextBox ID="txtaddress" runat="server" MaxLength="64" Width="250"></asp:TextBox></div>

<div>Phone</div><div><asp:TextBox ID="txtphone" runat="server" MaxLength="64" Width="250"></asp:TextBox></div>

<div>AppDate</div><div><asp:TextBox ID="txtappdate" runat="server" MaxLength="64" Width="250"></asp:TextBox></div>

<div class="clearer">
</div>

<div><asp:Button ID="btnSaveEmployee" runat="server" Text="Save" UseSubmitBehavior="False" CausesValidation="true" OnClick="btnSaveEmployee_Click"/>
<asp:Button ID="btnCancelEmployee" runat="server" CausesValidation="false" Text="Cancel"/></div>
<input id="first" type="hidden" runat="server" />
<input id="last" type="hidden" runat="server" />
<input id="social" type="hidden" runat="server" />
<input id="department" type="hidden" runat="server" />
<input id="address" type="hidden" runat="server" />
<input id="phone" type="hidden" runat="server" />
<input id="applicationDate" type="hidden" runat="server" />
</ContentTemplate>
</atlas:UpdatePanel>
</asp:Panel>

<input type="hidden" runat="server" id="hidOrderFlag" value="1" />
<input type="button" id="btnhiddenemployee" runat="server" style="display:none" onserverclick="btnhiddenemployee_ServerClick1"/>


<cc1:ModalPopupExtender ID="MyExtender" runat="server">
<cc1:ModalPopupProperties TargetControlID="btnhiddenemployee" PopupControlID="pnlEmployee" OkControlID="btnSaveEmployee"/>
</cc1:ModalPopupExtender>


<atlas:AutoCompleteExtender ID="AutoCompleteExtender1" DropDownPanelID="testdiv" runat="server">
<atlas:AutoCompleteProperties Enabled="true"
MinimumPrefixLength="1"
TargetControlID="TextBox1"
ServicePath="~/Services/ProductService.asmx"
ServiceMethod="FindProducts" />
</atlas:AutoCompleteExtender>
</div>
</form

</body>
</html
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using AjaxControlToolkit.Design;
using AtlasControlToolkit;
using AtlasTextBoxAutoComplete.SQlQuery;

public partial class _Default : BasePage
{

// Db Declaration

SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["EMP"].ConnectionString);
DataSet ds = new DataSet();

protected void Page_Load(object sender, EventArgs e)
{

// btnSaveEmployee.OnClientClick = String.Format("fnClickOK('{0}','{1}')", btnSaveEmployee.UniqueID, "");

GridView1.Attributes.Add("Init", "fnSetFocus('" + txtFirstName.Text + "');");
GridView1.Attributes.Add("Init", "fnSetFocus('" + txtLastName.ClientID + "');");
btnSaveEmployee.OnClientClick = String.Format("fnClickOK('{0}','{1}')", btnSaveEmployee.UniqueID, "");
if (conn.State == ConnectionState.Open) conn.Close();
conn.Open();
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{

if (TextBox1.Text != "")
{
Bind(this.TextBox1.Text);
}
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{

GridView1.PageIndex = e.NewPageIndex;
Bind(this.TextBox1.Text);

}
protected void CommandButton_OnSelect(object sender, EventArgs e)
{


ImageButton btnEdit = sender as ImageButton;
GridViewRow row =(GridViewRow)btnEdit.NamingContainer;

hidEmployeeEditIndex.Value = Scrub(row.Cells[1].Text);
txtFirstName.Text = Scrub(row.Cells[2].Text);
txtLastName.Text = Scrub(row.Cells[3].Text);
txtsocial.Text = Scrub(row.Cells[4].Text);
txtdepartment.Text = Scrub(row.Cells[5].Text);
txtaddress.Text =Scrub(row.Cells[6].Text);
txtphone.Text = Scrub(row.Cells[7].Text);
txtappdate.Text = Scrub(row.Cells[8].Text);


}

public void Bind(string lastname)
{

if (conn.State == ConnectionState.Open) conn.Close();
conn.Open();
SqlCommand cmd = new SqlCommand("SP_GetEmployees", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@dotnet.itags.org.lastname", System.Data.SqlDbType.VarChar, 255));
cmd.Parameters["@dotnet.itags.org.lastname"].Value = lastname;
SqlDataReader reader = cmd.ExecuteReader();

DataTable dt = new DataTable();

DataColumn dc0 = new DataColumn();
dc0.ColumnName = "empID";

DataColumn dc1 = new DataColumn();
dc1.ColumnName = "lastname";

DataColumn dc2 = new DataColumn();
dc2.ColumnName = "firstname";

DataColumn dc3 = new DataColumn();
dc3.ColumnName = "social";

DataColumn dc4 = new DataColumn();
dc4.ColumnName = "department";

DataColumn dc5 = new DataColumn();
dc5.ColumnName = "addres";

DataColumn dc6 = new DataColumn();
dc6.ColumnName = "phone";

DataColumn dc7 = new DataColumn();
dc7.ColumnName = "appdate";

dt.Columns.Add(dc0);
dt.Columns.Add(dc1);
dt.Columns.Add(dc2);
dt.Columns.Add(dc3);
dt.Columns.Add(dc4);
dt.Columns.Add(dc5);
dt.Columns.Add(dc6);
dt.Columns.Add(dc7);

ds.Tables.Add(dt);

while (reader.Read())
{


DataRow dr = dt.NewRow();
dr["empID"] = reader.GetValue(0).ToString();
dr["lastname"] = reader.GetValue(1).ToString();
dr["firstname"] = reader.GetValue(2).ToString();
dr["social"] = reader.GetValue(3).ToString();
dr["department"] = reader.GetValue(4).ToString();
dr["addres"] = reader.GetValue(5).ToString();
dr["phone"] = reader.GetValue(6).ToString();
dr["appdate"] = reader.GetValue(7).ToString();

dt.Rows.Add(dr);
}
reader.Close();
GridView1.DataSource = ds;
GridView1.DataBind();
}

protected void btnhiddenemployee_ServerClick1(object sender, EventArgs e)
{
hidOrderFlag.Value = "1";
}
//protected void btnSaveEmployee_OnClick(object sender, EventArgs e)
//{
// SqlCommand cmd = new SqlCommand("update tblemployee set firstname= '" + txtFirstName.Text + "',lastname='" + txtLastName.Text + "',social='" + txtsocial.Text + "',department='" + txtdepartment.Text + "',addres='" + txtaddress.Text + "',appdate='" + txtappdate.Text + "' where empID = '" + hidEmployeeEditIndex.Value + "'");
// cmd.Connection = conn;
// cmd.ExecuteNonQuery();
// Bind(this.TextBox1.Text);

//}



protected void btnSaveEmployee_Click(object sender, EventArgs e)
{

// txtFirstName.Text = "SDFSD";
// first.Value = txtFirstName.Text;



//first.Value = Pa
first.Value = txtFirstName.Text;
//last.Value = txtLastName.Text;
//social.Value = txtsocial.Text;
//department.Value = txtdepartment.Text;
//address.Value = txtaddress.Text;
//phone.Value = txtphone.Text;
//applicationDate.Value = txtappdate.Text;


}
protected void txtFirstName_TextChanged(object sender, EventArgs e)
{


}
}

Hirajivisa84 ,

One solution is to register hidden fields and set those fields in a javascript function. That javascript function would be tied to your OnOkScript attribute of your ModalPopupExtender and so would be called whenever your OkControlId control is clicked. That javascript would set the hidden fields to the values of the fields in the modal popup.

Later, you can click a button that fires the code-behind handler that would read those hidden fields.

Here is an example that works:

<%@.PageLanguage="C#"AutoEventWireup="true"Codebehind="Default.aspx.cs"Inherits="AJAXEnabledWebApplication1._Default" %>

<%@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <htmlxmlns="http://www.w3.org/1999/xhtml">

<headid="Head1"runat="server">

<title>Untitled Page</title> </head>

<bodystyle="background-color: transparent">

<formid="form1"runat="server">

<asp:ScriptManagerID="ScriptManager1"runat="server"/>

<div>

</div>

<asp:ButtonID="Button1"runat="server"Style="position: absolute; left: 119px; top: 322px;"

Text="Show Popup"Width="86px"/><asp:ButtonID="Button2"runat="server"Style="position: absolute; left: 277px; top: 198px;"

Text="Read Hidden Value"Width="137px"OnClick="Button2_Click"/>

<cc1:ModalPopupExtenderID="ModalPopupExtender1"runat="server"PopupControlID="Panel1"

TargetControlID="Button1"OkControlID="OkButton"CancelControlID="CancelButton"OnOkScript="SaveTextBoxValue()">

</cc1:ModalPopupExtender>

<asp:PanelID="Panel1"runat="server"Height="183px"Width="199px"Style="left: 36px;

position: absolute; top: 123px"BackColor="#C0FFFF">

<asp:TextBoxID="TextBox2"runat="server"></asp:TextBox>

<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>

<asp:ButtonID="CancelButton"runat="server"Text="Cancel"/>

<asp:ButtonID="OkButton"runat="server"Text="Ok"/></asp:Panel>

<asp:LabelID="Label1"runat="server"Text="Label"style="left: 302px; position: absolute; top: 160px"></asp:Label>

</form> </body>

</html>

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

namespace AJAXEnabledWebApplication1

{

publicpartialclass_Default : System.Web.UI.Page

{

protectedvoid Page_Load(object sender,EventArgs e)

{

string hiddenValue ="initial value";

Page.ClientScript.RegisterHiddenField("myHiddenField", hiddenValue);

string clientScript =

"<script type=\"text/javascript\"> "

+" function SaveTextBoxValue()"

+" { "

+" document.getElementById(\"myHiddenField\").value = document.getElementById(\"TextBox2\").value;"

+" } "

+"</script>";Page.ClientScript.RegisterClientScriptBlock(typeof(_Default),"MyClientScript", clientScript,false);

}

protectedvoid Button2_Click(object sender,EventArgs e)

{

Label1.Text = Request.Form["myHIddenField"];

}

}

}

In the Page_Load function we register the hidden field "myHiddenField" and also the javascript.

On the page is a Button2 labeled "Read Hidden Value" that when clicked will fire the codebehind to read the registered hidden field into Label1. In your case I think you want to save those values to several variables, which you can do at Button2_Click event handler, or something similar.

Pete


Hi Pete,

thanks for your reply.

first I tried your sample.But I get only theinitial value.I dont know what is the problem really.and Please tell me i need to get the textbox values from PopupWindow when i press the ok button.

Raji


atcually i got the values from gridView for Textbox using the below code.

protected void CommandButton_OnSelect(object sender, EventArgs e)
{

ImageButton btnEdit = sender as ImageButton;


GridViewRow row =(GridViewRow) btnEdit.NamingContainer;
txtFirstName.Text = row.Cells[1].Text;
txtLastName.Text = row.Cells[2].Text;
txtsocial.Text = row.Cells[3].Text;
txtdepartment.Text = row.Cells[4].Text;
txtaddress.Text = row.Cells[5].Text;
txtappdate.Text = row.Cells[7].Text;
}

if i edit or not edit , i need to get the textbox's values from popupwindow for update my database.Please tell me for get the new Textbox values from popupwindow using atlas PopupExtender?? I tried the below for get the TextBox values but i got only null value.I need to get the values correctly.

in aspx:

btnSaveEmployee is for PopupWindow Button :

<asp:Button ID="btnSaveEmployee" runat="server" Text="Save" UseSubmitBehavior="False" CausesValidation="true" OnClick="btnSaveEmployee_Click"/>

Modal PopupExtender :

<cc1:ModalPopupExtender ID="MyExtender" runat="server">
<cc1:ModalPopupProperties TargetControlID="btnhiddenemployee" PopupControlID="pnlEmployee"/>
</cc1:ModalPopupExtender>

Code behind :

protected void btnSaveEmployee_Click(object sender, EventArgs e)
{

// txtFirstName.Text = "SDFSD";
// first.Value = txtFirstName.Text;

first.Value = txtFirstName.Text;

//first.Value = Pa
// first.Value = txtFirstName.Text;
//last.Value = txtLastName.Text;
//social.Value = txtsocial.Text;
//department.Value = txtdepartment.Text;
//address.Value = txtaddress.Text;
//phone.Value = txtphone.Text;
//applicationDate.Value = txtappdate.Text;


}

the first ,last and etc are input hidden.

I need to get the new Values from PopupWindow in ModalPopupExtender.Help Me!!!!!!!!

Thanks

Raji

Thanks.

raji


Hi Raji,

I double checked the code posted, and it partially worked; i noticed when I hit the refresh button the label goes back to being the initial value. So here is an updated version of the codebehind:

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

namespace AJAXEnabledWebApplication1

{

publicpartialclass_Default : System.Web.UI.Page

{

protectedvoid Page_Load(object sender,EventArgs e)

{

Page.ClientScript.RegisterHiddenField("myHiddenField","");

string clientScript =

"<script type=\"text/javascript\"> "

+" function SaveTextBoxValue()"

+" { "

+" document.getElementById(\"myHiddenField\").value = document.getElementById(\"TextBox2\").value;"

+" } "

+"</script>";Page.ClientScript.RegisterClientScriptBlock(typeof(_Default),"MyClientScript", clientScript,false);

}

protectedvoid Button2_Click(object sender,EventArgs e)

{

string hiddenValue = Request.Form["myHiddenField"];

Label1.Text = hiddenValue;

}

}

}

Click on the "Show Popup" button. Type something into the top textbox in the modal popup. click ok. Click on "Read Hidden Value.", which will then show the new text you typed in.

Also, I'm not using the Atlas toolkit at all, only the AjaxControlToolkit version 1.0. And I'm not using "input" HTML tags of type hidden either, just registering hidden fields and reading them in the codebehind.

Pete


hi pete

I tried ur post but i didnt get a result.bec i got sys is undefined error.( using IE 7). however my requirement is also till not solved.

I used atlas ModalPopupExtender for GridView.In textBox i choose anyone item,that related fields displayed in the GridView.In this GridView I have used

Atlas ModalPopupExtender.if i click anyone of the row edit button the corresponding particular row values displayed in all the textbox's in popwindow.

but if i edit the textbox values and after clicking the ok button in the popupwindow I got only the null values.(The code is shown above).my requirement is i need to retrieve that new values from the Popupwindow.bec it helpful for update my database and also update the GridView.

Please help me or anyone knows help me!!!!

Raji



Hi,

I dont know whether your problem is solved. But for you reference i suggest you to gohttp://www.aspdotnetcodes.com/Ajax_ModalPopup_PostBack_GridView.aspx . this article explains the modalpopup in gridview, also with fine source code and example .

thanks