gridview usercontrol asp.net [英] gridview usercontrol asp.net

查看:57
本文介绍了gridview usercontrol asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以使用asp.net在usercontrol中使用gridview。我想将gridview控件添加到我的应用程序中的所有表单。任何想法...

解决方案

 <   asp:GridView     ID   =  grdCategory    runat   =  server    AutoGenerateColumns   = 错误   宽度  =   1100px  

< span class =code-attribute> DataKeyNames = CourseCatID 字体名称 = verdana,arial,helvetica,sans-ser if 字体大小 = 8pt

CellPadding = 4 ForeColor = #333333 GridLines = >
< >
< ; asp:ButtonField 文字 = SingleClick CommandName = SingleClick 可见 = 错误 / >
< asp:BoundField HeaderText = CourseCatID 可见 = false DataField = < span class =code-keyword> CourseCatID / >
< asp:TemplateField HeaderText = 课程类别 >
< ItemTemplate >
< asp:Label ID = lblCourseCatID runat = server 可见 = false 文字 =' <% #Eval( CourseCatID)%>' > < / asp:标签 >
< a < span class =code-attribute> href = java<! - no - > script:toggleDiv('mydiv <% #Eval( CourseCatID)%>') >
< asp:TextBox ID = txtCourseCatName < span class =code-attribute> runat = server 文本 = ' <% #Eval( CourseCatName)%>' 字体-Size = XX-Sma ll

< span class =code-attribute> 字体名称 = Verdana 宽度 = < span class =code-keyword> 300px 可见 = false > < / asp:TextBox >
< asp:Image ID = < span class =code-keyword> img onclick = javascript:切换(this); runat = server ImageUrl = 〜/ Images / minus.gif

< span class =code-attribute> < span class =code-attribute> 工具提示 = 折叠 Width = 7px 高度 = 7px ImageAlign = AbsMiddle / > < / a >
< asp:Label ID = lbllastname 高度 = 15px runat = server 文字 =' <% #Eval( CourseCatName)%>' > < / asp:标签 >
< div id = mydiv <% #Eval( CourseCatID)%> >


< br / >
<% - OnClick =ImageAdd_click - %>
< asp:ImageButton ID = ImageAdd 高度 = 17px ImageUrl = Images / addCourse.png runat < span class =code-keyword> = server
< span class =code-attribute>
< span class =code-attribute> CommandName = cmdAdd CommandArgument =' <% #Eval( CourseCatID)%>' / >
< br / >
< br / >


< asp:Panel ID = pnlCourse runat = 服务器 > < / asp:Panel >
< cuc1:CourseUserControl ID = CourseUserControl1 runat = server / >
< br / >

< br / >
< br / >
< br / >


< / div >
< / ItemTemplate >
< / asp:TemplateField >


是的,您可以在usercontrol中使用gridview查看功能齐全可编辑的GridView控件 [ ^ ]和

创建自己的GridView控件 - ALT.Net的方式 [ ^ ]


你好,



查看CP中的以下链接:

Gridview用户控件中的事件处理 [ ^ ]

GridView用户控件 [ ^

can we use gridview in usercontrol using asp.net. I want add gridview control to all the forms in my application.any idea...

解决方案

<asp:GridView ID="grdCategory" runat="server" AutoGenerateColumns="False" Width="1100px"

                    DataKeyNames="CourseCatID" Font-Names="verdana,arial,helvetica,sans-serif" Font-Size="8pt"

                    CellPadding="4" ForeColor="#333333" GridLines="None">
                    <Columns>
                        <asp:ButtonField Text="SingleClick" CommandName="SingleClick" Visible="False" />
                        <asp:BoundField HeaderText="CourseCatID" Visible = "false" DataField="CourseCatID" />
                        <asp:TemplateField HeaderText="Course Category">
                            <ItemTemplate>
                                <asp:Label ID="lblCourseCatID" runat="server" Visible="false" Text='<%# Eval("CourseCatID")%>'></asp:Label>
                                     <a href="java<!-- no -->script:toggleDiv('mydiv<%# Eval("CourseCatID")%>')">
                                     <asp:TextBox ID="txtCourseCatName" runat="server" Text='<%# Eval("CourseCatName") %>' Font-Size="XX-Small"

                                Font-Names="Verdana" Width="300px" Visible="false"></asp:TextBox>
                                    <asp:Image ID="img" onclick="javascript:Toggle(this);" runat="server" ImageUrl="~/Images/minus.gif"

                                        ToolTip="Collapse" Width="7px" Height="7px" ImageAlign="AbsMiddle" /></a>
                                <asp:Label ID="lbllastname" Height="15px" runat="server" Text='<%# Eval("CourseCatName")%>'> </asp:Label>
                                <div id="mydiv<%# Eval("CourseCatID")%>">


                                    <br />
                                        <%--OnClick="ImageAdd_click" --%>
                                    <asp:ImageButton ID="ImageAdd" Height="17px" ImageUrl="Images/addCourse.png" runat="server"

                                        CommandName="cmdAdd" CommandArgument='<%# Eval("CourseCatID") %>' />
                                        <br />
                                        <br />


                                    <asp:Panel ID="pnlCourse" runat="server"></asp:Panel>
                                    <cuc1:CourseUserControl ID="CourseUserControl1"  runat="server" />
                                    <br />

                                    <br />
                                     <br />
                                      <br />


                                </div>
                            </ItemTemplate>
                        </asp:TemplateField>


Yes,you can use gridview in usercontrol have a look on Full-featured Editable GridView Control[^] and
Create Your Own GridView Control - the ALT.Net's Way[^]


Hello,

Look at the following links in CP:
Event handling in a Gridview User Control[^]
GridView User control[^]


这篇关于gridview usercontrol asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆