<asp:datagrid id="DataVisible2" runat="server" CssClass="datagrid1" ShowHeader="False" ShowFooter="False" PagerStyle-HorizontalAlign="right" PagerStyle-PageButtonCount="1" PagerStyle-Mode="NumericPages" pageSize="1" Allowpaging="true" OnPageIndexChanged="DataVisible1_Next" CellSpacing="0" CellPadding="0"
 AutoGenerateColumns="false" OnItemCommand="EditCommands" DataKeyField="id" PagerStyle-Visible="false" BorderWidth="0" BorderColor="#C0C0C0" BorderStyle="solid">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<table class="DataVisible1Table1" bgColor="#ebebeb" border="1" bordercolor="#c0c0c0" style="BORDER-COLLAPSE: collapse" cellSpacing="0" cellPadding="0" width="100%" align="center">
<tr>
<td>
<TABLE class="PeiJianManageInputTable">
<TR>
<TD>配件管理</TD>
</TR>
</TABLE>
<TABLE class="PeiJianManageInputTable1">
<TR>
<TD class="PeiJianManageInputTable1Td">配件名称</TD>
<TD><INPUT class="css_input" id="txtTitle2" value='<%# DataBinder.Eval(Container.DataItem,"Title")%>' type="text" name="txtTitle2" runat="server"></TD>
<TD class="PeiJianManageInputTable1Td">供应商</TD>
<TD><INPUT class="css_input" id="txtProvider2" value='<%# DataBinder.Eval(Container.DataItem,"Provider")%>' type="text" name="txtProvider2" runat="server"></TD>
</TR>
<TR>
<TD class="PeiJianManageInputTable1Td">进价</TD>
<TD><INPUT class="css_input" id="txtPurchasePrice2" value='<%# DataBinder.Eval(Container.DataItem,"PurchasePrice")%>' type="text" name="txtPurchasePrice2" runat="server"></TD>
<TD class="PeiJianManageInputTable1Td">售价</TD>
<TD><INPUT class="css_input" id="txtPrice2" value='<%# DataBinder.Eval(Container.DataItem,"Price")%>' type="text" name="txtPrice2" runat="server"></TD>
</TR>
<TR>
<TD class="PeiJianManageInputTable1Td">购货时间</TD>
<TD><INPUT class="css_input" id="txtBuyDate2" value='<%# DataBinder.Eval(Container.DataItem,"BuyDate")%>' type="text" name="txtBuyDate2" runat="server"></TD>
</TABLE>
<TABLE class="PeiJianManageInputTable2">
<TR>
<TD>货架号</TD>
<TD>货架位数</TD>
<TD>货架层数</TD>
</TR>
<TR>
<TD><INPUT class="css_input" id="txtMark2" value='<%# DataBinder.Eval(Container.DataItem,"Mark")%>' type="text" name="txtMark2" runat="server"></TD>
<TD><INPUT class="css_input" id="txtDigit2" value='<%# DataBinder.Eval(Container.DataItem,"Digit")%>' type="text" name="txtDigit2" runat="server"></TD>
<TD><INPUT class="css_input" id="txtFloor2" value='<%# DataBinder.Eval(Container.DataItem,"Floor")%>' type="text" name="txtFloor2" runat="server"></TD>
</TR>
</TABLE>
<TABLE class="PeiJianManageInputTable3">
<TR>
<TD>存货量</TD>
<TD>出货量</TD>
<TD>总数量</TD>
</TR>
<TR>
<TD><INPUT class="css_input" id="txtMerchandise2" value='<%# DataBinder.Eval(Container.DataItem,"Merchandise")%>' type="text" name="txtMerchandise2" runat="server"></TD>
<TD><INPUT class="css_input" id="txtShipment2" value='<%# DataBinder.Eval(Container.DataItem,"Shipment")%>' type="text" name="txtShipment2" runat="server"></TD>
<TD><INPUT class="css_input" id="txtTotalAmount2" value='<%# DataBinder.Eval(Container.DataItem,"TotalAmount")%>' type="text" name="txtTotalAmount2" runat="server"></TD>
</TR>
</TABLE>
<TABLE class="PeiJianManageInputTable5">
<TR>
<TD class="PeiJianManageInputTable5Td1" height="10"></TD>
<TD class="PeiJianManageInputTable5Td2" align="right">
<asp:ImageButton id="Imagebutton11" onclick="onclick_updateinfo" runat="server" ImageUrl="/Images/ok-02.gif" borderstyle="none" CommandName="update"></asp:ImageButton>
<asp:ImageButton id="Imagebutton12" onclick="onclick_canel" runat="server" ImageUrl="/Images/canel-01.gif" borderstyle="none" CommandName="canel"></asp:ImageButton>
<SPAN onclick="return Confirm_Del();">
<asp:ImageButton id="Imagebutton16" onclick="onclick_deleteinfo" runat="server" ImageUrl="/Images/delete-01.gif"
borderstyle="none" CommandName="delete"></asp:ImageButton>
</SPAN>
</TD>
</TR>
</TABLE>
</td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle Visible="False" HorizontalAlign="Right" PageButtonCount="1" Mode="NumericPages"></PagerStyle>
</asp:datagrid>---------------------------------------------------------

解决方案 »

  1.   

    老大你的CodeBehind的
    代码呢?
      

  2.   

    //编辑数据
    public void EditCommands(Object sender, DataGridCommandEventArgs e)
    {
    connectionstr();

    int editID = (int) DataVisible2.DataKeys[e.Item.ItemIndex];//更新数据
    if (e.CommandName == "update")
    {
    // try
    // {
    shbConn.Open();
    shbUpdateData="UPDATE PeiJianManage SET Title='" + txtTitle2.Value 
    + "',Provider='" + txtProvider2.Value 
    + "',PurchasePrice='" + txtPurchasePrice2.Value 
    + "',Price='" + txtPrice2.Value
    + "',BuyDate='" + txtBuyDate2.Value
    + "',Mark='" + txtMark2.Value
    + "',Digit='" + txtDigit2.Value
    + "',Floor='" + txtFloor2.Value
    + "',Merchandise='" + txtMerchandise2.Value
    + "',Shipment='" + txtShipment2.Value
    + "',TotalAmount='" + txtTotalAmount2.Value
    + "'WHERE id=" + editID.ToString();
    shbComm=new OleDbCommand(shbUpdateData,shbConn);
    shbComm.ExecuteNonQuery();
    shbConn.Close();
    connection1();
    // }
    // catch
    // {
    // }
    }
      

  3.   

    大哥,你这到底是用datagrid还是repeater啊,不是这么用的
    看看
    http://dev.csdn.net/article/63/63892.shtm
      

  4.   

    是不是用 repeater 就可以???
      

  5.   

    用 DataGrid 的默认格式真的很难看啊,有别的方法任意设置吗??比如用 Table 或 Div 等