Showing posts with label values. Show all posts
Showing posts with label values. Show all posts

Wednesday, March 28, 2012

How do I Select Values in Cascading Dropdowns

Using VS 2005, ASP.NET AJAX 1.0 and AJAX Toolkit 10618

I have 2 dropdowns using the Cascading Dropdown from the toolkit, these are both connected to a web service and this all seems to work fine. No other Ajax type controls are being used on the page.

How do I set the dropdown values from server side code? or any method to change the selected item in each dropdown once they have been set.

I did manage to get the selected value to pass in with the data from the callbacks on the web service and this works fine when the page first opens, but any attempt to change the selected values once the page is open either through the web service or server code does not work; both drop downs keep their previous setting. I have setup a breakpoint on the data (in the web service) before it is sent back to the page and I can see the item that should be selected but yet the dropdowns do not change their selected value.

I have tried combobox.selectedvalue = "Some Value" and the GetTargetProperties method doesn't seem available anymore.

I have this nagging suspicious feeling I am missing something obvious.

Please Help

This video has a walk though.

http://asp.net/learn/videos/view.aspx?tabid=63&id=77


I had used the information in this video to get started which was a great help.

Now I need to now how to set a selected value in the dropdowns. I can get the values set on the initial page load, it is changing the values once the page is loaded and the initail values have been set. The setting of the selected values are done through code. It seems that the dropdowns have a memory once their intial selected values are set and cannot be changed.


figured it out!

Had a look at the toolkit source code and it was obvious...

cascadingdropdown1.clientstate = "String of selected value"

All is good in the world again!


Turns out SelectedValue works as well. I was trying to do this on the dropdown itself instead of the cascading control.

Wednesday, March 21, 2012

How Can i Get the new Values from the PopupWindow in Atlas ModalPopupWindow with samples

if i change the textbox values in Popupwindow and if i click the ok button (ServerSide code) I cant get the new values from the popup window in modalpopupExtender.Anyone Please help me how can i get the new values from the popupwindow in atlas modalpopupExtender.Explain with simple example.

Thanks

Hi,

Try this:

<%@. Page Language="VB" %>

<%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!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 Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
TextBox1.Text = DateTime.Now.ToString()
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:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="always">
<ContentTemplate>
<asp:Panel ID="Panel1" onscroll="javascript:saveScroll();" runat="server" Height="50px" Width="125px" Style="position: static;
overflow: scroll; height: 350px; border: solid 1px blue; background-color: White;
display: none;">
<table border="0" cellpadding="0" cellspacing="0" width="480px">
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
<asp:Button ID="Button1" runat="server" Text="Update" OnClick="Button1_Click" />
<asp:Button ID="Button3" runat="server" Text="Close" />
<asp:Button ID="Button4" runat="server" Text="OK" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</asp:Panel>
<asp:Button ID="Button2" runat="server" Text="Show" />
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel1" OkControlID="Button4"
CancelControlID="Button3" TargetControlID="Button2">
</cc1:ModalPopupExtender>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>

<script type='text/javascript'>
var scrollLeft = 0;
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

function EndRequestHandler(sender, args) {
document.getElementById('Button2').click();
setScroll();
}

function setScroll()
{
document.getElementById('<%= Panel1.ClientID %>').scrollLeft = scrollLeft;
}

function saveScroll()
{
scrollLeft = document.getElementById('<%= Panel1.ClientID %>').scrollLeft;
}
</script>

</body>
</html>

Get the value in javascript via "document.getElementById('TextBox1').value".

Best Regards

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