我想实现这样的效果选checkbox然后按编辑按钮然后所选行进入编辑状态!
解决方案 »
- 帮我把一个限制文本域文字并提示还剩多少字的限制的JS改成JQ或其他JS形式
- 今天听人说用.NET的都用过动软代码生成器,是真的吗?
- 分页的gridview如何整个导出到excel?
- 在线等,请教各位高手关于HttpResponse的问题
- 技术问题!为什么部署到iis5.1后Button代码执行就一直在等待!!
- 这句话该怎么改啊?
- 关于用存储过程来分页,并且不要需要主键的,除了用游标的方法以外,请问有什么好的方案?
- 对象名userinfo无效
- asp.net的gridview如何增加一列checkbox,并且这列checkbox的name相同?
- ASP.NET中怎样include一个Javscript文件?
- 谁有支持pop3功能的Jmail组件,请给小妹一份。up者有分
- 一个引用javascript文件的问题,请各位大哥帮帮忙!
<asp:DataGrid id="dgInfo" style="Z-INDEX: 101; LEFT: 198px; POSITION: absolute; TOP: 49px" runat="server" AutoGenerateColumns="False">
<ItemStyle Font-Size="10pt" Font-Names="Times New Roman" ForeColor="#0000C0"></ItemStyle>
<HeaderStyle Font-Size="10pt" Font-Names="Times New Roman" Font-Bold="True" ForeColor="White" BackColor="Navy"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="id" ReadOnly="True" HeaderText="ID"></asp:BoundColumn>
<asp:BoundColumn DataField="utype" ReadOnly="True" HeaderText="UserType"></asp:BoundColumn>
<asp:BoundColumn DataField="command" ReadOnly="True" HeaderText="Command">
<HeaderStyle Width="120px"></HeaderStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="ProjectID">
<ItemTemplate>
<asp:TextBox ID="txtQuantity" Runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"quantity")%>' Width="60px">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
后台代码:
Sub updateQuantity(ByVal id As Integer, ByVal quantity As Integer) Dim myCommand As SqlDataAdapter = New SqlDataAdapter("usp_UpdataQuantity", myConnection)
myCommand.SelectCommand.CommandType = CommandType.StoredProcedure myCommand.SelectCommand.Parameters.Add(New SqlParameter("@projectid", SqlDbType.Int, 4))
myCommand.SelectCommand.Parameters("@projectid").Value = id myCommand.SelectCommand.Parameters.Add(New SqlParameter("@quantity", SqlDbType.Int, 4))
myCommand.SelectCommand.Parameters("@quantity").Value = quantity myConnection.Open()
myCommand.SelectCommand.ExecuteNonQuery()
myConnection.Close()
End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Dim i As Integer '循环遍历textbox里面的值
For i = 0 To dgInfo.Items.Count - 1 Dim id As Integer = dgInfo.Items(i).Cells(0).Text
Dim quantityid As TextBox = dgInfo.Items(i).FindControl("txtQuantity")
Dim quantity As Integer = quantityid.Text If quantity <> 0 Then
updateQuantity(id, quantity)
End If
Next
BindData()
End Sub