我在vs2003中可以实现,在vs2005中却没反应了,也没报错,
将数据从sql2005中取出,绑定到DropDownList,这个能实现,
但想选择DropDownList的值后,将这个值显示出来,这个却不能实现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.SqlClient;
using System.Text;
public partial class index : System.Web.UI.Page
{
#region
public SqlDataAdapter ada_FriendLink;
public DataTable dt_FriendLink = new DataTable();
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bind_DD_FriendLink("Select * from FriendLink ");
}
}
public void Bind_DD_FriendLink(string sqlbind)
{ Log.PublicClass.Binding(sqlbind, ada_FriendLink, dt_FriendLink);
//this.DD_FriendLink.Items.Clear();
//插入一行,绑定"请选择 " 3个字,
DD_FriendLink.Items.Insert(0, new ListItem("请选择 ", "-1 ")); //绑定数据库中 到,
for (int i = 0; i < dt_FriendLink.Rows.Count; i++)
{
ListItem item = new ListItem();
item.Text = dt_FriendLink.Rows[i]["name"].ToString();
item.Value = dt_FriendLink.Rows[i]["name"].ToString(); DD_FriendLink.Items.Add(item);
// Response.Write(DDdep.Items.ToString());
} }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void DropDownList1_TextChanged(object sender, EventArgs e)
{
switch (this.DD_FriendLink.SelectedValue)
{
case "华南农业大学":
Response.Write("http://www.scau.edu.cn/xw/");
//Response.Redirect("http://www.scau.edu.cn/xw/");
break;
//case "":
// break;
}
}
}
哪位帮忙分析一下呀,
将数据从sql2005中取出,绑定到DropDownList,这个能实现,
但想选择DropDownList的值后,将这个值显示出来,这个却不能实现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.SqlClient;
using System.Text;
public partial class index : System.Web.UI.Page
{
#region
public SqlDataAdapter ada_FriendLink;
public DataTable dt_FriendLink = new DataTable();
#endregion
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Bind_DD_FriendLink("Select * from FriendLink ");
}
}
public void Bind_DD_FriendLink(string sqlbind)
{ Log.PublicClass.Binding(sqlbind, ada_FriendLink, dt_FriendLink);
//this.DD_FriendLink.Items.Clear();
//插入一行,绑定"请选择 " 3个字,
DD_FriendLink.Items.Insert(0, new ListItem("请选择 ", "-1 ")); //绑定数据库中 到,
for (int i = 0; i < dt_FriendLink.Rows.Count; i++)
{
ListItem item = new ListItem();
item.Text = dt_FriendLink.Rows[i]["name"].ToString();
item.Value = dt_FriendLink.Rows[i]["name"].ToString(); DD_FriendLink.Items.Add(item);
// Response.Write(DDdep.Items.ToString());
} }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void DropDownList1_TextChanged(object sender, EventArgs e)
{
switch (this.DD_FriendLink.SelectedValue)
{
case "华南农业大学":
Response.Write("http://www.scau.edu.cn/xw/");
//Response.Redirect("http://www.scau.edu.cn/xw/");
break;
//case "":
// break;
}
}
}
哪位帮忙分析一下呀,
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货