<asp:datagrid id="Datagrid1" Visible="true" Runat="server" CssClass="DatagridDemandComeOut3" ShowHeader="False"
AutoGenerateColumns="False" Width="600" Height="30">
<columns>
<asp:templatecolumn>
<itemtemplate>
<%# DataBinder.Eval(Container.DataItem,"NumberPlate")%>
</itemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
==============================
如何获得上面 asp:datagrid 的值???

解决方案 »

  1.   

    最好用Label或者别的控件,然后用FindControl("")显示得到
      

  2.   

    直接从datatable里读
    =====================怎么读?
      

  3.   

    不明白你的意思
    Table[0].Rows[0][1].ToString()可以吧
      

  4.   

    vb.net寫法:DataGrid1.Items(行).Cells(列).Text
      

  5.   

    for(int i=0;i<this.Datagrid1.Items.Count;i++)
    {
    this.response.write(this.Datagrid1.Items[i][0].ToString() + "<br>");
    }表示第几行第0列(根据你绑定值的位置)的值,以此类推
      

  6.   

    http://www.cnblogs.com/lovecherry/archive/2005/04/16/138882.html
      

  7.   

    For Each遍历控件.然后再FindControl
      

  8.   

    是这样的:从
    <asp:datagrid id="Datagrid1" Visible="true" Runat="server" CssClass="DatagridDemandComeOut3" ShowHeader="False"
    AutoGenerateColumns="False" Width="600" Height="30">
    <columns>
    <asp:templatecolumn>
    <itemtemplate>
    <%# DataBinder.Eval(Container.DataItem,"NumberPlate")%>
    </itemtemplate>
    </asp:templatecolumn>
    </columns>
    </asp:datagrid>得到值放到shbInsertData="INSERT INTO CarPageAGarage(" + " [Date] " + " ," + " NumberPlate "
    + " ," + " Title " + " ," + " Unit " + " ," + " Amount " + " ,"
    + " UnitPrice " + " ," + " [Sum] " + ") Values" 
    + "('" + CarPageAGaragetxtDate.Value + "','" + AAAAAAAAAAAAA + "','"
    + txtTitle.Value + "','" + txtUnit.Value + "','" + txtAmount.Value + "','"
    + txtUnitPrice.Value + "','" + txtSum.Value + "')";中的"AAAAAAAAAAAAA " 处-----------------------------请问怎么做????
      

  9.   


    可以這樣子:多加一個內容一樣的隱藏列,取隱藏列的值 e.Item.Cells(0).Text 
    <asp:BoundColumn Visible="False" DataField="NumberPlate" HeaderText="NumberPlate">
    </asp:BoundColumn>
      

  10.   

    可以這樣子:多加一個內容一樣的隱藏列,取隱藏列的值 e.Item.Cells(0).Text 
    <asp:BoundColumn Visible="False" DataField="NumberPlate" HeaderText="NumberPlate">
    </asp:BoundColumn>------------------------然后怎么取值??