關於GridView設置編輯或不可編輯的相關問題!


當系統標識為用戶自定義的時候修改刪除可編輯,否則不可編輯!由於設置權限問題,所有在gridview控件中有一個系統標識的掩藏列:

<Columns>
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <input type="checkbox" id="ckvalue" <%#Eval("Function_IsSys").ToString() == "2"? " " :"disabled='disabled'" %> name="ckvalue" value='<%# Eval("Function_ID") %>' /></ItemTemplate>
                                            <HeaderTemplate>
                                                <input type="checkbox" id="ckall"  name="ckall" disabled="disabled" onclick="CheckAll(this.checked,'ckvalue')" /></HeaderTemplate>
                                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                                            <HeaderStyle HorizontalAlign="Center" />
                                        </asp:TemplateField>
                                        <asp:BoundField HeaderStyle-CssClass="display" ItemStyle-CssClass="display" DataField="Function_IsSys" />
                                        <asp:TemplateField HeaderText="功能編碼">
                                            <ItemTemplate>
                                                <%--<a href="javascript:location.href='UserInfoView.aspx?id=<%# Eval("Function_NO") %>'" title="詳細">--%><%# Eval("Function_NO")%></a>
                                            </ItemTemplate>
                                            <HeaderStyle Font-Bold="False" HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:TemplateField>
                                        <asp:BoundField HeaderText="功能名稱" DataField="Function_Name">
                                            <HeaderStyle HorizontalAlign="Center" Font-Bold="False" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                        <asp:TemplateField HeaderText="系統標識">
                                            <ItemTemplate>
                                                <%# Eval("Function_IsSys").ToString() == "1" ? "系統定義" : "用戶自定義"%>
                                            </ItemTemplate>
                                            <HeaderStyle Font-Bold="False" HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:TemplateField>
                                         <asp:BoundField HeaderText="功能描述" DataField="Function_Description">
                                            <HeaderStyle HorizontalAlign="Center" Font-Bold="False" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                        <asp:TemplateField HeaderText="操&nbsp;&nbsp;&nbsp;作">
                                            <ItemTemplate>
                                            <%-- <input type="checkbox" id="ckvalue" <%#Eval("Function_IsSys").ToString() == "2"? " " :"disabled='disabled'" %> name="ckvalue" value='<%# Eval("Function_ID") %>' /></ItemTemplate>--%>
                                                    <asp:HyperLink ID="Update" ToolTip="修改"  runat="server" NavigateUrl='<%#String.Format("ModulFunctionEdit.aspx?id={0}", Eval("FUNCTION_ID")) %>'><img src="../skins/sky/icon/edt.gif" border="0" />修改&nbsp;</asp:HyperLink>
                                    
                                                    <asp:HyperLink  ID="View" Enabled="false"  ToolTip="詳情" runat="server" NavigateUrl='<%#String.Format("ModulFunctionView.aspx?id={0}",Eval("FUNCTION_ID")) %>' ><img src="../skins/sky/icon/layout_content.gif" border="0" />詳細&nbsp;</asp:HyperLink>
                                              

                                                <%#Eval("Function_IsSys").ToString() == "2"?
                                                        "<asp:HyperLink ID='Delete' Enabled='false' runat='server' ToolTip='刪除'  NavigateUrl='#' ><span style='cursor:pointer' onclick=DelInfoById(" + Eval("FUNCTION_ID") + ",XC_Web.Frame.SystemManage.ModulFunction,'/Frame/SystemManage/ModulFunction.aspx')><img src='../skins/sky/icon/del.gif' border='0'/>刪除</span></span></asp:HyperLink>" :
                                                                                                            "<asp:HyperLink ID='Delete' runat='server' NavigateUrl='#' ToolTip='刪除' disabled='disabled' ><img src='../skins/sky/icon/del.gif' border='0'/>刪除</asp:HyperLink>"
                                                    %>
                                            </ItemTemplate>
                                            <HeaderStyle Font-Bold="False" />
                                            <ItemStyle HorizontalAlign="Center" Width="22%" />
                                        </asp:TemplateField>
                                    </Columns>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM