我有两个选项卡(添加与修改/删除)用JS来实现的转换。
现在 我的问题是:我选择修改/删除选项卡 里面有个选择客户的下拉列表
想实现:根据选择的客户,其他相关信息的文本框全部自动填上。但是实际上没有,下拉列表设置了autopostback="true"后,下拉列表选择了之后,页面直接跳转回添加这个选项卡这个页面。(实际上说当前页)
请问这种情况该怎么解决~用JS也行 求具体~谢谢大家~~~
我写的代码是:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//绑定下拉列表里的值
ClientInfoDAO clientDao = new ClientInfoDAO();
DataTable dt = clientDao.selectClient();
choosePro.DataSource = dt;
choosePro.DataTextField="Fullname";
choosePro.DataValueField = "ClientId";
choosePro.DataBind(); }
} protected void choosePro_SelectedIndexChanged(object sender, EventArgs e) {
//根据选中的下拉列表值绑定各个文本框的值
string id = choosePro.SelectedValue;
ClientInfoDAO clientDao = new ClientInfoDAO();
DataTable n = clientDao.selectClientAll(id);
txtAddress1.Text = n.Rows[0][3].ToString();
txtBank1.Text = n.Rows[0][5].ToString();
txtBankNum1.Text = n.Rows[0][6].ToString();
txtContacter1.Text = n.Rows[0][8].ToString();
txtConTel1.Text = n.Rows[0][9].ToString();
txtEmail1.Text = n.Rows[0][10].ToString();
txtFax1.Text = n.Rows[0][7].ToString();
txtFullName1.Text = n.Rows[0][1].ToString();
txtPostNum1.Text = n.Rows[0][4].ToString();
txtShortName2.Text = n.Rows[0][2].ToString();
}<asp:Label ID="chosePro" runat="server" Text="选择客户:" ></asp:Label>
<asp:DropDownList ID="choosePro" runat="server" CssClass="txtBox" AutoPostBack="True"
>
</asp:DropDownList>
现在 我的问题是:我选择修改/删除选项卡 里面有个选择客户的下拉列表
想实现:根据选择的客户,其他相关信息的文本框全部自动填上。但是实际上没有,下拉列表设置了autopostback="true"后,下拉列表选择了之后,页面直接跳转回添加这个选项卡这个页面。(实际上说当前页)
请问这种情况该怎么解决~用JS也行 求具体~谢谢大家~~~
我写的代码是:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//绑定下拉列表里的值
ClientInfoDAO clientDao = new ClientInfoDAO();
DataTable dt = clientDao.selectClient();
choosePro.DataSource = dt;
choosePro.DataTextField="Fullname";
choosePro.DataValueField = "ClientId";
choosePro.DataBind(); }
} protected void choosePro_SelectedIndexChanged(object sender, EventArgs e) {
//根据选中的下拉列表值绑定各个文本框的值
string id = choosePro.SelectedValue;
ClientInfoDAO clientDao = new ClientInfoDAO();
DataTable n = clientDao.selectClientAll(id);
txtAddress1.Text = n.Rows[0][3].ToString();
txtBank1.Text = n.Rows[0][5].ToString();
txtBankNum1.Text = n.Rows[0][6].ToString();
txtContacter1.Text = n.Rows[0][8].ToString();
txtConTel1.Text = n.Rows[0][9].ToString();
txtEmail1.Text = n.Rows[0][10].ToString();
txtFax1.Text = n.Rows[0][7].ToString();
txtFullName1.Text = n.Rows[0][1].ToString();
txtPostNum1.Text = n.Rows[0][4].ToString();
txtShortName2.Text = n.Rows[0][2].ToString();
}<asp:Label ID="chosePro" runat="server" Text="选择客户:" ></asp:Label>
<asp:DropDownList ID="choosePro" runat="server" CssClass="txtBox" AutoPostBack="True"
>
</asp:DropDownList>
其实 我是对ajax不熟悉,你能具体说说么?
点你的img 跳到淘宝去