Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > dropDownList Problem

Reply
Thread Tools

dropDownList Problem

 
 
nurit
Guest
Posts: n/a
 
      01-27-2005
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_SelectedInd exChanged);
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>");
}

}
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DropDownList inside GridView: How to set SelectedIndex for the DropDownList? keithb ASP .Net 1 11-01-2006 05:24 AM
GridView: Filter DropDownList for another DropDownList =?Utf-8?B?SnVhbmpv?= ASP .Net 0 12-29-2005 07:44 AM
GridView: Filtr DropDownList from another DropDownList =?Utf-8?B?SnVhbmpv?= ASP .Net 0 12-23-2005 01:31 PM
databinding a Dropdownlist to another dropdownlist tshad ASP .Net 8 10-19-2005 10:00 PM
Using a data-bind dropdownlist to populate another data-bind dropdownlist mr2_93 ASP .Net 1 10-02-2005 05:07 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57