前端
引用
<%@ Register Assembly="CustomeDropDown" Namespace="CustomeDropDown" TagPrefix="cc" %>
HTML控件
<cc:CustomLinkButton ID="lbtnApprove" runat="server" CssClass="easyui-linkbutton" iconcls="icon-ok" plain="true" Text="<%$Resources:General,Approve %>" />
多选框
<asp:TemplateColumn> <HeaderTemplate> <asp:CheckBox ID="chkSelectAll" runat="server" onclick="SetAllInDataGrid(this.id)" /> </HeaderTemplate> <ItemStyle HorizontalAlign="center" /> <ItemTemplate> <asp:CheckBox ID="chkSelect" runat="server" /> </ItemTemplate> </asp:TemplateColumn>
后端
页面加载
Protected Overrides Sub PageLoad() If Not Page.IsPostBack Then If GetItem(SQLSort.SortBy.ToString) = "" Then AppendItem(SQLSort.SortBy.ToString, "this.AgreementNo") End If If GetItem(SQLSort.SortDirect.ToString) = "" Then AppendItem(SQLSort.SortDirect.ToString, SQLSortDirect.Desc.ToString) End If Refresh() InitControls() If Request.QueryString("Clear") = 1 Then '需要更新 ClearItem() Else InitSearchControls() End If ctlPager.Pager = New Pager(20, GetItem(SessionKey.PAGE_NO, 1)) msSortExpression = GetItem(SQLSort.SortBy.ToString(), "this.AgreementNo") & " " & GetItem(SQLSort.SortDirect.ToString(), SQLSortDirect.Desc.ToString) BindData() lbtnApprove.OnClickFunction = "javascript:return CheckSelectMessage('" & Resources.General.OneItemNeeded & "')" '至少选择一项提示 Else msSortExpression = GetItem(SQLSort.SortBy.ToString(), "this.AgreementNo") & " " & GetItem(SQLSort.SortDirect.ToString(), SQLSortDirect.Desc.ToString) End If End Sub
点击事件
1 Protected Sub lbtnApprove_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lbtnApprove.Click 2 For Each oGridItem As DataGridItem In grdMainList.Items 3 Dim chkSelect As CheckBox = CType(oGridItem.FindControl("chkSelect"), CheckBox) 4 If chkSelect.Checked Then 5 Dim oAgreement As Agreement = moAgreementBD.Load(grdMainList.DataKeys(oGridItem.ItemIndex)) 6 Dim oAgent As User = moUserBD.Load(Convert.ToInt32(SessionVar.UserID)) 7 Dim oWorkingUser As User = moUserBD.Load(Convert.ToInt32(SessionVar.WorkingUserID)) 8 Select Case agreementProcessor.Approve(oAgreement, oWorkingUser, oAgent, "") 9 Case -1 10 BindData() 11 lblError.Text = Resources.General.UnexpectedError 12 Return 13 Case 0 14 End Select 15 End If 16 Next 17 BindData() 18 End Sub