Unable to set property 'innerText' of undefined or null reference - javascript

I have wrote this code:
<%# Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script language="javascript" type="text/javascript">
// <![CDATA[
function btnClient_onclick() {
document.getElementById("lblClient").innerText = "Changed";
document.getElementById("lblServer").innerText = "Server";
}
// ]]>
</script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
Welcome to ASP.NET!
</h2>
<p>
<asp:Button ID="btnServer" runat="server" onclick="btnServer_Click"
Text="Server" />
<asp:Label ID="lblServer" runat="server" Text="Server"></asp:Label>
</p>
<p>
<input id="btnClient" type="button" value="Client" onclick="return btnClient_onclick()" />
<asp:Label ID="lblClient" runat="server" Text="Client"></asp:Label>
</p>
</asp:Content>
and when i run it, got this errro : Unable to set property 'innerText' of undefined or null reference

Set
ClientIDMode to static
on both the labels and see if that works

try this
document.getElementById("lblClient").setAttribute('text', "Changed");

Related

ASP.Net WebForms not firing UI events from codebehind file

I have simple UI in aspx file, with aspx.cs codebehind. No matter what kind of control I use, events from this file wont fire - the only ones that are working are events like Init, PageLoad.
Events are created via designer.
What I tried:
Basic OnClick on markup page
OnClick in designer
Inline c# Code in markup page via javascript
PageMethods
Pure javascript click
Whole new page
When I add for example alert for click event in javascript, it works. But Im not able to run my c# code after user clicks on button.
I have also removed everything from file (validation, other controls...), but not even then my code works.
There are also no errors in console
Markup Page
<%# Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Views/Shared/Site.Master" EnableEventValidation="false" CodeBehind="Report.aspx.cs" Async="true" Inherits="App.Web.Views.Besparingen.Report" %>
<%# Register Assembly="Microsoft.ReportViewer.WebForms" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<asp:Content runat="server" ContentPlaceHolderID="Content" ID="Content1">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css"
rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
<link href="http://cdn.rawgit.com/davidstutz/bootstrap-multiselect/master/dist/css/bootstrap-multiselect.css" rel="stylesheet" type="text/css" />
<script src="http://cdn.rawgit.com/davidstutz/bootstrap-multiselect/master/dist/js/bootstrap-multiselect.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$('[id*=selectYear]').multiselect({
includeSelectAllOption: true
});
});
</script>
<script type="text/javascript">
$(function () {
$('[id*=selectPortfolio]').multiselect({
includeSelectAllOption: true
});
});
</script>
<script type="text/javascript">
$(function () {
$('[id*=selectSector]').multiselect({
includeSelectAllOption: true
});
});
</script>
<form runat="server" id="form">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" ScriptMode="Release" ClientIDMode="Static" ViewStateMode="Enabled">
</asp:ScriptManager>
<div style="margin: 10px;">
<asp:Label Style="margin-right: 40px;" ID="YearLabel" Text="Year:" runat="server" AssociatedControlID="selectYear"></asp:Label>
<asp:ListBox ID="selectYear" runat="server" DataValueField="Value" DataTextField="Text" SelectionMode="Multiple" CausesValidation="false"></asp:ListBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ForeColor="Red"
ControlToValidate="selectYear"
ValidationGroup="yearGroup"
ErrorMessage="Select year."
runat="server">
</asp:RequiredFieldValidator>
</div>
<div style="margin: 10px;">
<asp:Label Style="margin-right: 12px;" ID="PortfolioLabel" Text="Portfolio:" runat="server" AssociatedControlID="selectPortfolio"></asp:Label>
<asp:ListBox ID="selectPortfolio" runat="server" DataValueField="Value" DataTextField="Text" CausesValidation="false"></asp:ListBox>
</div>
<div style="margin: 10px;">
<asp:Label Style="margin-right: 25px;" ID="SectorLabel" Text="Sector:" runat="server" AssociatedControlID="selectSector"></asp:Label>
<asp:ListBox ID="selectSector" runat="server" DataValueField="Value" DataTextField="Text" CausesValidation="false"></asp:ListBox>
</div>
<div>
<asp:Button ID="reportButton" runat="server" OnClick="reportButton_Click" ClientIDMode="Static" Text="Create report" CausesValidation="true" ValidationGroup="yearGroup" />
</div>
<div style="margin-top: 40px;">
<rsweb:ReportViewer runat="server" ID="reporter" Width="100%" ClientIDMode="AutoID" ProcessingMode="Local" BackColor="White" BorderStyle="None" ToolBarItemBorderStyle="None" InternalBorderStyle="None" BorderColor="White" InternalBorderColor="White" ToolBarItemBorderColor="White" AsyncRendering="false"></rsweb:ReportViewer>
</div>
</form>
<script type="text/javascript">
$(document).ready(function () {
//$("#reportButton").click(function () {
// event.preventDefault();
// alert("Handler for .click() called.");
//});
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Title" runat="server">
Besparingen
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ValidationSummary" runat="server">
</asp:Content>
Code Behind file
public partial class Report : System.Web.Mvc.ViewPage<model>
{
List<string> years = new List<string>();
string sector;
string portfolio;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
selectPortfolio.DataSource = Model.List[0].Portfolios;
selectPortfolio.DataBind();
selectYear.DataSource = Model.List[0].Years;
selectYear.DataBind();
selectSector.DataSource = Model.List[0].Sectors;
selectSector.DataBind();
}
}
protected void reportButton_Click(object sender, EventArgs e)
{
foreach (ListItem item in selectYear.Items)
{
if (item.Selected)
{
years.Add(item.Text);
}
}
sector = selectSector.SelectedItem?.Text ?? string.Empty;
portfolio = selectPortfolio.SelectedItem?.Text ?? string.Empty;
if (years.Count > 0)
{
BesparingenDS.DataTable1DataTable table = new BesparingenDS.DataTable1DataTable();
DataTable1TableAdapter adapter = new DataTable1TableAdapter();
adapter.Fill(table, sector, portfolio, string.Join(",", years));
ReportDataSource datasource = new ReportDataSource("DataSource", (DataTable)table);
System.Security.PermissionSet sec = new System.Security.PermissionSet(System.Security.Permissions.PermissionState.Unrestricted);
reporter.LocalReport.SetBasePermissionsForSandboxAppDomain(sec);
reporter.LocalReport.ReportPath = "Views\\Besparingen\\BesparingenReport.rdlc";
reporter.LocalReport.DataSources.Clear();
reporter.LocalReport.DataSources.Add(datasource);
reporter.LocalReport.Refresh();
reporter.DataBind();
}
}
}
Thank you for help and sorry for my bad english

How to change value of MaskEditExtender's attribute Mask using javascript

I have project in which i have textbox on which I have implement MaskEditExtender and set a value of Mask attribute like this
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
<%# Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script src="Scripts/jquery-1.6.2.min.js" type="text/javascript"></script>
<title></title>
<script>
$(document).ready(function () {
//$("#TextBox1").val('00.0000');
debugger;
document.getElementById('TextBox1').value = "00.0000";
});
function CallMe() {
debugger;
if (document.getElementById('CheckBox1').checked) {
$find("MaskedEditExtender1").set_Mask("99.99");
document.getElementById('TextBox1').value = "00.00";
} else {
$find("MaskedEditExtender1").set_Mask("99.9999");
document.getElementById('TextBox1').value = "00.0000"
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ScriptManager1" runat="server" />
<%--<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>--%>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:CheckBox ID="CheckBox1" runat="server" onchange="javascript:CallMe()" />
<asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server"
TargetControlID="TextBox1" BehaviorID="MaskedEditExtender1" Mask="99.9999"
MessageValidatorTip="true" MaskType="Number" InputDirection="LeftToRight"
AcceptNegative="None" ErrorTooltipEnabled="True" >
</asp:MaskedEditExtender>
</div>
</form>
</body>
</html>
I have initialed text-box value in $(document).ready function. And my task is to change mask value on change of checkbox. This task i have done with a javascript function "CallMe". All of the code is work fine but when user click on text box. Textbox value change from "00.00" to "00.0000" i.e. initial value of Mask attribute of MaskEditExtender.
Please help me!
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
<%# Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script src="Scripts/jquery-1.6.2.min.js" type="text/javascript"></script>
<title></title>
<script>
$(document).ready(function () {
//$("#TextBox1").val('00.0000');
debugger;
document.getElementById('TextBox1').value = "00.0000";
});
function CallMe() {
debugger;
if (document.getElementById('CheckBox1').checked) {
$find("MaskedEditExtender1")._MaskConv = "99.9";
//$find("MaskedEditExtender1").set_Mask("99.9");
//$find("MaskedEditExtender1")._convertMask();
document.getElementById('TextBox1').value = "00.0";
alert($find("MaskedEditExtender1").get_Mask());
}
else {
$find("MaskedEditExtender1")._MaskConv = "99.9999";
//$find("MaskedEditExtender1").set_Mask("99.9999");
//$find("MaskedEditExtender1")._convertMask();
document.getElementById('TextBox1').value = "00.0000"
alert($find("MaskedEditExtender1").get_Mask());
}
}
function txtBox1_ClientClicked() {
// alert($find("MaskedEditExtender1").get_Mask());
// $find("MaskedEditExtender1").set_Mask("99.9");
// document.getElementById('TextBox1').value = "00.0";
alert($find("MaskedEditExtender1").get_Mask());
}
</script>
</head>
<body style="height: 137px">
<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ScriptManager1" runat="server" />
<%--<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>--%>
<asp:TextBox ID="TextBox1" runat="server" onclick="txtBox1_ClientClicked()"></asp:TextBox>
<asp:CheckBox ID="CheckBox1" runat="server" onchange="javascript:CallMe()" />
<asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server"
TargetControlID="TextBox1" Mask="99.9999"
MessageValidatorTip="true" MaskType="Number" InputDirection="LeftToRight"
AcceptNegative="None" ErrorTooltipEnabled="True" >
</asp:MaskedEditExtender>
</div>
</form>
</body>
</html>
For changing mask value using javascritp we can use _MaskConv or .set_Mask("new value") and combine with _convertMask function.

Passing child values in Parent with TabPanel

I am having problem with the script of passing values from child to parent with tabpanel (controller). Within that Tab there's a textbox. When I tried to pass a value that within the TabPanel it doesn't work. When I removed the panel it works.
Here the html script from
Parent.aspx
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="Form1" runat="server">
<cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0">
<cc1:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel1">
<HeaderTemplate>
TabPanel1<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
</HeaderTemplate>
<ContentTemplate>
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<asp:Button ID="button1" runat="server" OnClick="button1_Click" Text="Button" />
</div>
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="TabPanel2">
</cc1:TabPanel>
</cc1:TabContainer>
</form>
</body>
</html>
and here's the child and Javascript
child.aspx
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Child.aspx.cs" Inherits="Child" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="Initialtest" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="Initialtest2" runat="server"></asp:TextBox>
<br />
<%--<input type="button" value="Select" onclick="SetName();" />--%>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</div>
<script type="text/javascript">
function SetName() {
if (window.opener != null && !window.opener.closed) {
var txtName = window.opener.document.getElementById("TextBox1");
txtName.value = document.getElementById("Initialtest").value;
var txtName1 = window.opener.document.getElementById("TextBox2");
txtName1.value = document.getElementById("Initialtest2").value;
}
alert("test");
window.close();
}
</script>
</form>
</body>
</html>
the child.aspx.cs (code behind)
public partial class Child : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
//protected void Button1_Click(object sender, EventArgs e)
//{
// //
// Button1.Attributes.Add("onclick", "javascript:SetName();");
//}
protected void Button1_Click(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "SetName()", true);
}
}
The scenario child must pass the value to textbox1 within that TabPanel. Hoping that someone will help me to resolve the problem.
Done, I resolved this problem.
<script type="text/javascript">
function SetName() {
if (window.opener != null && !window.opener.closed) {
var txtName = window.opener.document.getElementById("TextBox1");
txtName.value = document.getElementById("Initialtest").value;
var txtName1 = window.opener.document.getElementById("TextBox2");
txtName1.value = document.getElementById("Initialtest2").value;
}
alert("test");
window.close();
}
</script>

Click event of control in dynamically loaded usercontrol not firing in .js file

I have a aspx page with a placeholder in an update panel. The user control is attached to the placeholder depending the value of a dropdown on the page. The user control loads correctly, but it seems that the click event of the button is not firing. I've put a breakpoint in the .js file, but it never goes into the js function. Not sure if the javascript is even loaded.
The aspx page:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Page.aspx.cs" Inherits="UserControlTest.Page" %>
<%# Register Src="~/TestUserControl.ascx" TagPrefix="uc1" TagName="TestUserControl" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script src="Scripts/testUserControl.js"></script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager>
<div>
<h4>This is the page</h4>
<div class="form-group">
<label class="col-md-5 control-label" for="selUserControl">Enquiry Type <span class="glyphicon glyphicon-asterisk pull-right" style="color:red"></span> </label>
<div class="col-md-7">
<asp:DropDownList ID="selUserControl" CssClass="form-control reqrd" runat="server" OnSelectedIndexChanged="selUserControl_SelectedIndexChanged" AutoPostBack="True"></asp:DropDownList>
</div>
</div>
<div id="divUserControl">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:PlaceHolder runat="server" ID="phUserControl" />
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="selUserControl" />
</Triggers>
</asp:UpdatePanel>
</div>
</div>
</form>
</body>
</html>
The aspx.cs page:
protected void selUserControl_SelectedIndexChanged(object sender, EventArgs e)
{
TestUserControl uc = (TestUserControl)LoadControl("~/TestUserControl.ascx");
uc.ID = "ucUserControl";
phUserControl.Controls.Add(uc);
}
The .ascx page:
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="TestUserControl.ascx.cs" Inherits="UserControlTest.TestUserControl" %>
<div>
<h4>This is the User Control</h4>
</div>
<div class="form-group">
<div class="col-md-7">
<input type="button" id="btnPress" class="btn" value="Press!" />
</div>
</div>
The .js file:
$(document).ready(function () {
$("#btnPress").click(function () {
alert('Hi There from User Control');
});
});
By the time your js is run, #btnPress doesn't exist on the page (or at least the original #btnPress doesn't. #DelightedD0D is right. I'd look into using event delegates and attaching them to your document. This way you can attach/detach as many #btnPress as you'd like and your clicks will bubble to document and be handled by the delegate.
$(document).on('click', '#btnPress', function(){
alert('Hi There from User Control');
});

Javascript function doesn't get textbox value (text) after selecting an item in gridview

I have 2 pages, Cart.aspx and SelectPartner.aspx. And a JavaScript file, popup.js
In Cart.aspx I have a button that opens the page SelectPartner.aspx (as a new window) by the InvokePop() function.
In SelectPartner.aspx I have a gridview (with Selection enabled), a textbox, and buttons Ok and Cancel. This is what I want to do: when I select an item in the gridview, the value of one column is shown in the textbox, and when when I press the button Ok the function ReturnPartner() is called and should close the this window (SelectPartner.aspx) and show the value of this textbox in another textbox in the Cart.aspx page. If I write something into the TextBox in SelectPartner.aspx I can pass that value to the TextBox in the Cart.aspx page, but when I press a select button in the gridview the value is not passed.
I don't know what happens, please help me...
Here is the code of Cart.aspx
<%# Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Cart.aspx.cs" Inherits="NMv01.Cart" %>
<%# Register TagPrefix="asp" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit"%>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<style type="text/css">
#Select1
{
height: 16px;
width: 24px;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript" src="popup.js"></script>
<asp:Label ID="lblPartnerId" runat="server" Text="ID del Socio"></asp:Label>
<br />
<asp:TextBox ID="txtPartnerID" runat="server"></asp:TextBox>
<asp:Button ID="btnPartnerId" runat="server" Text="Elegir Socio" />
</asp:Content>
Now SelectPartner.aspx
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="SelectPartner.aspx.cs" Inherits="NMv01.catalog.SelectPartner" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="popup.js"></script>
<style type="text/css">
.style1
{
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="style1">
<tr>
<td>
</td>
<td>
<asp:GridView ID="grdSelectPartner" runat="server" AutoGenerateColumns="False"
AutoGenerateSelectButton="True" DataKeyNames="PartnerId"
DataSourceID="srcSelectPartner"
onselectedindexchanged="grdSelectPartner_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="PartnerName" HeaderText="PartnerName"
SortExpression="PartnerName" />
<asp:BoundField DataField="PartnerId" HeaderText="PartnerId" ReadOnly="True"
SortExpression="PartnerId" />
<asp:BoundField DataField="PartnerCity" HeaderText="PartnerCity"
SortExpression="PartnerCity" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="srcSelectPartner" runat="server"
ConnectionString="Data Source=ZUNIGA-PC\SQL1;Initial Catalog=NovamMonetanDB;User ID=sa; pwd=Next2011"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT [PartnerName], [PartnerId], [PartnerCity] FROM [Partners] ORDER BY [PartnerName]">
</asp:SqlDataSource>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Label ID="Label1" runat="server" Text="ID:"></asp:Label>
<asp:TextBox ID="txtPartner" runat="server"></asp:TextBox>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="btnOk" runat="server" Text="OK" OnClientClick="ReturnPartner()" />
<asp:Button ID="btnCancel" runat="server" Text="Cancelar" />
<br />
<br />
</td>
<td>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
And this is the popup.js file:
function InvokePop(fname) {
val = document.getElementById(fname).value;
// to handle in IE 7.0
if (window.showModalDialog) {
retVal = window.showModalDialog("SelectPartner.aspx?Control1=" + fname, 'Choose Partner', "dialogHeight:360px,dialogWidth:360px,resizable:yes,center:yes,");
document.getElementById(fname).value = retVal;
}
// to handle in Firefox
else {
retVal = window.open("SelectPartner.aspx?Control1=" + fname, 'Choose Partner', 'height=360px,width=360px,resizable=yes,modal=yes');
retVal.focus();
}
}
function ReturnPartner() {
var returnString = document.getElementById('txtPartner').value;
RetrieveControl();
// to handle in IE 7.0
if (window.showModalDialog) {
window.returnValue = returnString;
window.close();
}
// to handle in Firefox
else {
if ((window.opener != null) && (!window.opener.closed)) {
// Access the control.
window.opener.document.getElementById(ctr[1]).value = returnString;
}
window.close();
}
}
function RetrieveControl() {
//Retrieve the query string
queryStr = window.location.search.substring(1);
//Retrieve the control passed via querystring
ctr = queryStr.split("=");
}
I would suggest you to remove the use of window.showModalDialog() and use window.open() instead because Window.open() is supported uniformly by all browsers while window.ShowModalDialog() is an MSIE feature only.
showModalDialog() is said to have trouble "posting back" for which a iframe hack is needed.
i tested your code with window.open for all browsers and it worked great.

Categories

Resources