2018正版葡京赌侠诗ASP.NET简化编辑界面 V二

by admin on 2019年4月14日

先后是内需不断立异,上午做了,早晨再去看时,会觉它不够健全。

譬如说这个:http://www.cnblogs.com/insus/archive/2011/10/27/2226250.html 以往Insus.NET把它改为上边那么些样子:

2018正版葡京赌侠诗 1

  

以下内容于201一-1一-0柒 拾:00添加:

那篇与前一篇革新部分,大概大家会留意到动画演示,主假如GridVeiw的立异与删除会在每row都有。由此Insus.NET把它抽取出来,放在GridView外。致于壹回性更新多笔记录,Insus.NET在很早在此之前早已摄像过摄像:http://www.cnblogs.com/insus/articles/1400150.html 。还有2个便是剔除,在每row第2列放了1个CheckBox,让用户能够选择记录进行删减。

2018正版葡京赌侠诗 22018正版葡京赌侠诗 3View Code

<asp:TemplateField>
                        <ItemStyle BorderWidth=”1″ BorderColor=”#c0c0c0″ Width=”1%” />
                        <ItemTemplate>
                            <asp:CheckBox ID=”CheckBox1″ runat=”server” onclick=”Javascript:changeRowBgColor(this)” />
                        </ItemTemplate>
                    </asp:TemplateField>

 

删除前提醒用户确认之后,再删除,然则在那边遇上1个标题,就是先是判断是还是不是有取舍记录,再confirm用户确认删除

还有1些要留心的地点,便是选项CheckBox之后,行能够Highlight,完结方能够参见:http://www.cnblogs.com/insus/archive/2011/09/07/2169742.html

 

以下较完整代码,仅供参考:

2018正版葡京赌侠诗 42018正版葡京赌侠诗 5View Code

<asp:Table ID=”Table1″ runat=”server” CssClass=”table” CellPadding=”2″ CellSpacing=”0″>
                <asp:TableHeaderRow Height=”20″ BackColor=”#efebde” BorderWidth=”1″ BorderColor=”#c0c0c0″>
                    <asp:TableHeaderCell BackColor=”#efebde” BorderWidth=”1″ BorderColor=”#c0c0c0″>
                    Chinese Name
                    </asp:TableHeaderCell>
                    <asp:TableHeaderCell BackColor=”#efebde” BorderWidth=”1″ BorderColor=”#c0c0c0″ Width=”50%”>
                    English Name
                    </asp:TableHeaderCell>
                </asp:TableHeaderRow>
                <asp:TableRow Height=”20″>
                    <asp:TableCell BorderWidth=”1″ BorderColor=”#c0c0c0″>
                        <asp:TextBox ID=”txt_CName” runat=”Server” CssClass=”textbox” />
                    </asp:TableCell>
                    <asp:TableCell BorderWidth=”1″ BorderColor=”#c0c0c0″>
                        <asp:TextBox ID=”txt_EName” runat=”Server” CssClass=”textbox” />
                    </asp:TableCell>
                </asp:TableRow>
            </asp:Table>
            <div style=”margin-top: 3px; margin-bottom: 3px; padding: 3px;”>
                <asp:Button ID=”ButtonInsert” Text=”Insert” runat=”Server” OnClick=”ButtonInsert_Click” />
                <asp:Button ID=”ButtonUpdate” Text=”Update” runat=”Server” OnClick=”ButtonUpdate_Click” />
                <asp:Button ID=”ButtonDelete” Text=”Delete” runat=”Server” OnClick=”ButtonDelete_Click”
                    CausesValidation=”false” />
            </div>
            <asp:GridView ID=”GvCutterType” runat=”server” DataKeyNames=”CutterTypeId” AutoGenerateColumns=”false”
                CellPadding=”2″ CellSpacing=”0″ Width=”100%” BorderWidth=”0″ BorderColor=”#c0c0c0″
                RowStyle-Height=”20″ ShowHeader=”false”>
                <Columns>
                    <asp:TemplateField>
                        <ItemStyle BorderWidth=”1″ BorderColor=”#c0c0c0″ Width=”1%” />
                        <ItemTemplate>
                            <asp:CheckBox ID=”CheckBox1″ runat=”server” onclick=”Javascript:changeRowBgColor(this)” />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemStyle BorderWidth=”1″ BorderColor=”#c0c0c0″ />
                        <ItemTemplate>
                            <asp:TextBox ID=”txtCName” runat=”server” Text='<%# Eval(“CName”) %>’></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemStyle BorderWidth=”1″ BorderColor=”#c0c0c0″ Width=”50%” />
                        <ItemTemplate>
                            <asp:TextBox ID=”txtEName” runat=”server” Text='<%# Eval(“EName”) %>’></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>

 

xxx.aspx.cs:

2018正版葡京赌侠诗 62018正版葡京赌侠诗 7View Code

  protected void ButtonInsert_Click(object sender, EventArgs e)
    {
       //do Insert something
        //obj.Insert(……);
    }
  
    protected void ButtonUpdate_Click(object sender, EventArgs e)
    {
        //reference this url: http://www.cnblogs.com/insus/articles/1400150.html
    }

    protected void ButtonDelete_Click(object sender, EventArgs e)
    {       
       //如何取得具有选拔记录的主键:http://www.cnblogs.com/insus/articles/1413740.html

       //http://www.cnblogs.com/insus/archive/2011/11/07/2238927.html
       // string dataKeyNames = xxx; 

       // string[] arr = dataKeyNames.Substring(1).Split(‘,’);
        try
        {
            foreach (string s in arr)
            {
                //obj.Delter(s);
            }           
        }
        catch (Exception ex)
        {
            //alert exception message
        }
    } 

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图