每一行循环出一个文本框,和下拉框  
只要下拉框值变,文本框就赋上下拉框的值

解决方案 »

  1.   

    看好了是repeater 里面的文本框和下拉框 
      

  2.   

    只要你会英文.其实就是按你说的写:
    循环()
    {new 文本框,new 下拉框 }
    if(下拉框值变)
    {文本框.值=下拉框.值}
      

  3.   

            //下拉框事件
            protected void DDLZhiwei_SelectedIndexChanged(object sender, EventArgs e)
            {
                DropDownList d = sender as DropDownList;
                TextBox TextBox1 = d.Parent.FindControl("Tbzhiwei") as TextBox;
                TextBox1.Text = d.SelectedItem.Text;
                bind1();
            }很简单的事情,3行代码就能改变
      

  4.   

    现在的ajax编程非常诡异,许多号称“高级”的人如果你看其产品,其实也就是最低级的编程能力。
      

  5.   

    用js比较好。不要用服务端控件。
    JS参数要传入下拦控件和文本框控件的ID
    页面
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %><!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" language="javascript">
        function a(drp1)
        {
            var lastpos=drp1.id.lastIndexOf('_');
            
            if(lastpos>0)
            {
                var txtid= drp1.id.substring(0,lastpos)+"_TextBox1";
                document.getElementById(txtid).value=drp1.value;
                        }
            
        }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
            <asp:Repeater ID="Repeater1" runat="server" 
                onitemdatabound="Repeater1_ItemDataBound">
                <ItemTemplate>
                <%#Eval("col") %>
                    <asp:DropDownList ID="DropDownList1" runat="server" onchange="a(this)">
                    </asp:DropDownList>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </ItemTemplate>
            </asp:Repeater>
        
        </div>
        </form>
    </body>
    </html>
    代码
    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;namespace WebApplication1
    {
        public partial class _Default : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!Page.IsPostBack)
                {
                    DataTable dt = new DataTable();
                    dt.Columns.Add("col");
                    DataRow dw = dt.NewRow();
                    dw[0] = "a";
                    dt.Rows.Add(dw);
                    dw = dt.NewRow();
                    dw[0] = "b";
                    dt.Rows.Add(dw);
                    Repeater1.DataSource = dt;
                    Repeater1.DataBind();
                }
            }        protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
            {
                DropDownList d1 = (DropDownList)e.Item.FindControl("DropDownList1");
                d1.Items.Add("a");
                d1.Items.Add("b");
            }
        }
    }
      

  6.   

    楼上完美的回答,不过有点小瑕疵,我补上  
    function a(drp1)
      {
      var lastpos=drp1.id.lastIndexOf('_');
        
      if(lastpos>0)
      {
      var txtid= drp1.id.substring(0,lastpos)+"_TextBox1";
      document.getElementById(txtid).value=drp1.options[drp1.options.selectedIndex].innerHTML;  }
        
      }
    这样子才能获得下拉框选中的值