问题描述
以下是我写的代码,请各位帮忙看看那儿不对!谢谢!HTML代码<formid="form1"runat="server"><asp:DataListID="MyDataList"runat="server"><ItemTemplate>设备编号:<%#Container.DataItem("C_EquipmentSerialNumber")%><br>设备名称:<%#Container.DataItem("C_EquipmentName")%><br><asp:Buttonid="btnModify"runat="server"CommandName="edit"Text="编辑"EnableViewState="true"></asp:Button></ItemTemplate><EditItemTemplate>设备编号:<asp:TextBoxrunat="server"id="EquipmentSerialNumber"Text='<%#Container.DataItem("C_EquipmentSerialNumber")%>'></asp:TextBox><br>设备名称:<asp:TextBoxrunat="server"id="EquipmentName"Text='<%#Container.DataItem("C_EquipmentName")%>'></asp:TextBox><br><asp:Buttonid="btnUpdate"runat="server"CommandName="update"Text="修改"CommandArgument='<%#Container.DataItem("C_ID")%>'/><asp:Buttonid="btnCancle"runat="server"CommandName="cancel"Text="取消"/></EditItemTemplate></asp:DataList><!--数据绑定结束--></div></form>VB.net代码ProtectedSubMyDataList_EditCommand(ByValSenderAsObject,ByValeAsSystem.Web.UI.WebControls.DataListCommandEventArgs)HandlesMyDataList.EditCommandMyDataList.EditItemIndex=e.Item.ItemIndexOpenDataBaseToDataBind()'打开数据库的函数EndSubProtectedSubMyDataList_CancelCommand(ByValSenderAsObject,ByValeAsSystem.Web.UI.WebControls.DataListCommandEventArgs)'点取消按钮,不能触发此子程序MyDataList.EditItemIndex=-1OpenDataBaseToDataBind()'打开数据库的函数EndSubProtectedSubMyDataList_UpdateCommand(ByValSenderAsObject,ByValeAsSystem.Web.UI.WebControls.DataListCommandEventArgs)'点修改按钮,不能触发此子程序'还有,如何获得被修改记录的ID号Sub
解决方案
解决方案二:
edit,update,cancel首字母需要大写