N
nurit
hi,
I have a simple program with dropdownlist and textbox.
Write any text in the textbox and change the dropdownlist.
On dropdownlistchange i alert the results.
The program works well on my computer but when i copy the project to
the server it doesn't work. It doesn't go in the
DropDownList1_SelectedIndexChanged at all!!!
Like it doesn't exist!!! it goes to the 'Page Load' function and shows
the textbox value and show nothing on the dropdownlist alert.
please tell me what i did wrong ?????????
thanks
nurit
WebForm2.aspx:
<%@ Page language="c#" Codebehind="WebForm2.aspx.cs"
AutoEventWireup="false" Inherits="test.WebForm2" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm2</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<aspropDownList id="DropDownList1" autopostback="True"
style="Z-INDEX: 101; LEFT: 208px; POSITION: absolute; TOP: 136px"
runat="server"></aspropDownList>
<asp:TextBox id="TextBox1" style="Z-INDEX: 102; LEFT: 176px;
POSITION: absolute; TOP: 192px"
runat="server"></asp:TextBox>
</form>
</body>
</HTML>
WebForm2.aspx.cs:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace test
{
/// <summary>
/// Summary description for WebForm2.
/// </summary>
public class WebForm2 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.DropDownList DropDownList1;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
Response.Write ("<script>alert('Page_Load : " + TextBox1.Text +
"');</script>");
Response.Write ("<script>alert('Page_Load : " +
DropDownList1.SelectedValue + "');</script>");
if (!IsPostBack)
{
DropDownList1.Items.Add(new ListItem("select","1"));
DropDownList1.Items.Add(new ListItem("item2","2"));
DropDownList1.Items.Add(new ListItem("item3","3"));
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.DropDownList1.SelectedIndexChanged += new
System.EventHandler(this.DropDownList1_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DropDownList1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
Response.Write ("<script>alert('SelectedIndexChanged in: " +
DropDownList1.SelectedValue + "');</script>");
}
}
}
I have a simple program with dropdownlist and textbox.
Write any text in the textbox and change the dropdownlist.
On dropdownlistchange i alert the results.
The program works well on my computer but when i copy the project to
the server it doesn't work. It doesn't go in the
DropDownList1_SelectedIndexChanged at all!!!
Like it doesn't exist!!! it goes to the 'Page Load' function and shows
the textbox value and show nothing on the dropdownlist alert.
please tell me what i did wrong ?????????
thanks
nurit
WebForm2.aspx:
<%@ Page language="c#" Codebehind="WebForm2.aspx.cs"
AutoEventWireup="false" Inherits="test.WebForm2" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm2</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<aspropDownList id="DropDownList1" autopostback="True"
style="Z-INDEX: 101; LEFT: 208px; POSITION: absolute; TOP: 136px"
runat="server"></aspropDownList>
<asp:TextBox id="TextBox1" style="Z-INDEX: 102; LEFT: 176px;
POSITION: absolute; TOP: 192px"
runat="server"></asp:TextBox>
</form>
</body>
</HTML>
WebForm2.aspx.cs:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace test
{
/// <summary>
/// Summary description for WebForm2.
/// </summary>
public class WebForm2 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.DropDownList DropDownList1;
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
Response.Write ("<script>alert('Page_Load : " + TextBox1.Text +
"');</script>");
Response.Write ("<script>alert('Page_Load : " +
DropDownList1.SelectedValue + "');</script>");
if (!IsPostBack)
{
DropDownList1.Items.Add(new ListItem("select","1"));
DropDownList1.Items.Add(new ListItem("item2","2"));
DropDownList1.Items.Add(new ListItem("item3","3"));
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.DropDownList1.SelectedIndexChanged += new
System.EventHandler(this.DropDownList1_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DropDownList1_SelectedIndexChanged(object sender,
System.EventArgs e)
{
Response.Write ("<script>alert('SelectedIndexChanged in: " +
DropDownList1.SelectedValue + "');</script>");
}
}
}