<tr>
    <th width="219" scope="row">公司编号</th>
    <td width="197"><input name="cid" type="text" id="cid" value="" /></td>
  </tr>
  <tr>
    <th scope="row">公司名称</th>
    <td><input type="text" name="cname" id="cname"/></td>
  </tr>
  <tr>
    <th scope="row">公司描述</th>
    <td><input type="text" name="cdesc" id="cdesc"/></td>
  </tr>//这是前台的代码
string cid = dt.Rows[0]["cid"].ToString();
string cname= dt.Rows[0]["cname"].ToString();
string cdesc= dt.Rows[0]["cdesc"].ToString();
这是后台的 我获得的数据
我怎么才能让 cid cname  cdesc等数据显示到前台上去啊

解决方案 »

  1.   


    1、定义变量为前台可以访问
       protected string cid = ...;
       or
       public ...   then
       <%= cid %>即可
    2、服务器控件
       <asp:Literal ID="lCid" runat="server">
       class中赋值 lCid.Text = ...
      

  2.   

    这个……用gridview datarepeater datalist都可以实现……要看你希望是什么格式显示出来
      

  3.   

    把你的控件设为服务器控件,加上run="server" 属性,后台用this.cid.value = cid 就OK了