本文介绍了Triger如何在asp.net中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<%@ Page Language="C#" MasterPageFile="~/MiniErpMaster.master" AutoEventWireup="True"
Inherits="ItemMaster" CodeBehind="ItemMaster.aspx.cs" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ErpMainContent" runat="server">
<asp:UpdatePanel ID="Main" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="BtnSave" EventName="OnClick" />
</Triggers>
<ContentTemplate>
<div class="wrap">
<table width="100%">
<tr>
<td align="center" class="GenericBackgroud">
Item Master
</td>
</tr>
</table>
<table width="100%">
<tr>
<td>
<table>
<tr>
<td class="tdlablesize">
<asp:Label ID="lblItemName" runat="server" Text="Item Name"></asp:Label>
</td>
<td class="tdcustom">
<asp:TextBox ID="txtItemName" runat="server" CssClass="textbox" TabIndex="1"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvItemName" ForeColor="Red" ControlToValidate="txtItemName"
runat="server" Text="Required field"></asp:RequiredFieldValidator>
</td>
<td class="tdlablesize">
<asp:Label ID="lblItemType" runat="server" Text="Item Type"></asp:Label>
</td>
<td class="tdcustom">
<asp:TextBox ID="txtItemType" runat="server" CssClass="textbox" TabIndex="2"></asp:TextBox>
</td>
<td class="lablecolor">
<asp:CheckBox ID="chkIsResaleItem" Text="Resale Item" runat="server" TabIndex="5" />
</td>
</tr>
<tr>
<td class="tdlablesize">
<asp:Label ID="lblItemVolume" runat="server" Text="Item Volume"></asp:Label>
</td>
<td class="tdcustom">
<asp:TextBox ID="txtItemVolume" runat="server" CssClass="textbox" TabIndex="3"></asp:TextBox>
<strong>ml<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ErrorMessage="Numbers Only" ControlToValidate="txtItemVolume" ForeColor="Red"
ValidationExpression="^\d+$">
</asp:RegularExpressionValidator>
</strong>
</td>
<td class="tdlablesize">
<asp:Label ID="lblItemCode" runat="server" Text="Item Code"></asp:Label>
</td>
<td class="tdcustom">
<asp:TextBox ID="txtItemCode" CssClass="textbox" runat="server" TabIndex="4"></asp:TextBox>
<strong>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="Numbers Only"
ControlToValidate="txtItemCode" ForeColor="Red" ValidationExpression="^\d+$">
</asp:RegularExpressionValidator>
</strong>
</td>
<td>
<asp:TextBox ID="txtItemNbr" runat="server" CssClass="textbox" Visible="False"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<br />
<table width="100%">
<tr>
<td align="center">
<asp:Button ID="BtnSave" runat="server" Text="Save" OnClick="BtnSave_Click1" TabIndex="6"
CssClass="button" />
<asp:Button ID="btnUpdate" runat="server" Text="Update" CssClass="button" OnClick="btnUpdate_Click"
TabIndex="7" />
</td>
</tr>
</table>
<br />
<br />
<br />
Item Master Details
<br />
<div class="divCSSforGirdView">
<fieldset>
<asp:GridView Width="100%" ID="grdvwItemMasterList" runat="server" AutoGenerateColumns="false"
OnRowCommand="CustomersGridView_RowCommand" OnRowEditing="grdvwItemMasterList_RowEditing"
OnRowDeleting="grdvwItemMasterList_RowDeleting" OnSelectedIndexChanged="grdvwItemMasterList_SelectedIndexChanged"
TabIndex="8">
<SelectedRowStyle BackColor="#99CCFF" />
<Columns>
<asp:TemplateField>
<ItemStyle Width="80px" />
<ItemTemplate>
<asp:LinkButton ID="lnkDelete" runat="server" CommandName="Delete" Text="Delete"
CommandArgument='<%# Eval("ItemNbr") %>' OnClientClick="javascript:return confirm('Do you really want to \ndelete the item?');"
CausesValidation="false">
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:ButtonField ButtonType="Link" Text="Edit" CommandName="Edit" />
<asp:BoundField DataField="ItemNbr" HeaderText="Item Number" ReadOnly="true" />
<asp:BoundField DataField="ItemName" HeaderText="Item Name" ReadOnly="true" />
<asp:BoundField DataField="ItemType" HeaderText="Item Type" ReadOnly="true" />
<asp:BoundField DataField="ItemVolume" HeaderText="Item Volume" ReadOnly="true" />
<asp:BoundField DataField="ItemCode" HeaderText="Item Code" ReadOnly="true" />
<asp:BoundField DataField="IsResaleItem" HeaderText="Is Resale Item" ReadOnly="true" />
</Columns>
<FooterStyle CssClass="FooterStyle" />
<RowStyle CssClass="RowStyle" />
<EmptyDataRowStyle CssClass="EmptyRowStyle" />
<PagerStyle CssClass="PagerStyle" />
<SelectedRowStyle CssClass="SelectedRowStyle" />
<HeaderStyle CssClass="HeaderStyle" />
<EditRowStyle CssClass="EditRowStyle" />
<AlternatingRowStyle CssClass="AltRowStyle" />
</asp:GridView>
</fieldset>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
推荐答案
这篇关于Triger如何在asp.net中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!