固定行数的gridview [英] gridview with fixed no of rows

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

问题描述

我正在尝试创建一个具有固定行数(5)的gridview.如果gridivew不包含任何项目,则将显示五个空白行. n谢谢.
就像 http://www.fullonsms.com/AddMultiContacts.php?GroupId= [ ^ ]
在我的项目中,根据下拉列表中存在的项目编号显示行号.
以下是我的源代码.

I am trying to create a gridview with a fixed number of rows (5). If the gridivew contains no items then five blank rows will be shown. n Thank you.
just like http://www.fullonsms.com/AddMultiContacts.php?GroupId=[^]
In my project the no of row is showing according to no of item present in dropdown.
below is my sourcecode.

<asp:GridView ID="GridView1" runat="server" 
        onselectedindexchanged="GridView1_SelectedIndexChanged" 
        onrowdatabound="GridView1_RowDataBound" DataKeyNames="Group_ID" 
        AutoGenerateColumns="False" Height="100%" AllowPaging="True" PageSize="5" ShowFooter="true">
        <columns>
        <asp:TemplateField HeaderText="Gender"><itemtemplate>
            <asp:DropDownList ID="DropDownList1" runat="server" >
            <asp:ListItem >Mr
             <asp:ListItem>Ms
             </itemtemplate>
        
            <asp:TemplateField HeaderText="Name">
            <itemtemplate> 
                <asp:TextBox ID="nametxt" runat="server" onfocus="javascript:if(value == 'Name')value = '';"  
                     onblur="javascript:if(value == '')value = 'Name';style.color='Gray'">Name
            </itemtemplate>
            
            <asp:TemplateField HeaderText="MobileNo">
            <itemtemplate> 
                <asp:TextBox ID="mobilenotxt" runat="server"  onfocus="javascript:if(value == 'MobileNo')value = '';"  
                     onblur="javascript:if(value == '')value = 'MobileNo';style.color='Gray'">MobileNo
            </itemtemplate>
            
            <asp:TemplateField HeaderText="EmailID">
            <itemtemplate> 
                <asp:TextBox ID="Emailidtxt" runat="server" onfocus="javascript:if(value == 'EmailID')value = '';"  
                     onblur="javascript:if(value == '')value = 'MobileNo';style.color='Gray'">EmailID
            </itemtemplate>
            
            <asp:TemplateField HeaderText="City" >
            <itemtemplate> 
                <asp:TextBox ID="Citytxt" runat="server"  onfocus="javascript:if(value == 'City')value = '';"  
                     onblur="javascript:if(value == '')value = 'City';style.color='Gray'">City
            </itemtemplate>
            
            <asp:TemplateField HeaderText="Group">
            
            <itemtemplate>
          
               <asp:DropDownList ID="DropDownList2" runat="server"  >
               
                
                
               
           
            </itemtemplate>
             <footerstyle horizontalalign="Right" />

            <footertemplate>

             <asp:Button ID="ButtonAdd" runat="server" Text="Add New Row" />

            </footertemplate>

            
            
        </columns>
    

<rowstyle backcolor="#F7F7DE" />

<SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />

<pagerstyle backcolor="#F7F7DE" forecolor="Black" horizontalalign="Right" />

<HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />

<alternatingrowstyle backcolor="White" />
<emptydatatemplate>

<asp:DropDownList ID="DropDownList1" runat="server" >
<asp:ListItem Selected="False">Mr
 <asp:ListItem>Ms

 <asp:TextBox ID="nametxt" runat="server">Name
<asp:TextBox ID="mobilenotxt" runat="server">MobileNo 
<asp:TextBox ID="Emailidtxt" runat="server">EmailID 
<asp:TextBox ID="Citytxt" runat="server" >City
<asp:DropDownList ID="DropDownList2" runat="server"  ><asp:ListItem>select
                
</emptydatatemplate>



请建议我



kindly suggest me

推荐答案

在具有搜索功能的GridView [ ^ ]


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

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