asp.net2.0 GridView Url傳遞中文參數解決方案

來源:互聯網
上載者:User

 

 <asp:GridView ID="GridView1" PageSize="30" runat="server" Height="100%" Width="100%" AutoGenerateColumns="False" AllowPaging="True" EmptyDataText="沒有資料記錄!!" DataKeyNames="iProductBigSort_ID" BackColor="#EEEEE6" OnRowEditing="GridView1_RowEditing" onRowCancelingEdit="GridView1_RowCancelingEdit" onRowDeleting="GridView1_RowDeleting" onRowUpdating="GridView1_RowUpdating" >
            <Columns> 
                <asp:TemplateField HeaderText="主分類名">
                    <ItemTemplate><%# Eval("sProductBigSort")%></ItemTemplate>
                    <EditItemTemplate><asp:TextBox ID="sProductBigSort" Width="60%" runat="server" Text= <%# Eval("sProductBigSort")%> /></EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="管理子分類">
                    <ItemTemplate>
                    <a href="Admin_SmallSort.aspx?iProductBigSort_ID=<%# Eval("iProductBigSort_ID")%>&sProductBigSort=<%# Server.UrlEncode(Eval("sProductBigSort").ToString())%>">查看分類</a>
                     </ItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowEditButton="True" HeaderText="操作" ButtonType="Button"/>                
                 <asp:TemplateField HeaderText="刪除分類" ShowHeader="False">
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete" Text="刪除" OnClientClick="return confirm('嚴重警告!!此操作非常危險!!\n此操作將會刪除以下資訊:\n此主分類下的二級、三級小分類、相關品牌以及刪除相關的全部產品資料。\n確認要刪除嗎?');"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
             </Columns>
            <PagerSettings Visible="False" />
        </asp:GridView>


//這就實現了GridView的模板列傳遞URL參數時進行了編碼
/**//*
a href="Admin_SmallSort.aspx?iProductBigSort_ID=<%# Eval("iProductBigSort_ID")%>&sProductBigSort=<%# Server.UrlEncode(Eval("sProductBigSort").ToString())%>">查看分類</a>
*/


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.