3
Answers

Field in a Gridview

srinath

srinath

14y
2.7k
1
hi,

 I have a gridview where I need to create  a field. field should be like menu and sub-menu.

  like                       101
                        ex   se  tot

here  101 is header field.  and  ex,se and tot are sub-fields and in these three sub-fields, data should be retreived from database..


Subject Code Marks Awarded Remarks
End Exam Sessional Total
101 37 11 48 *
102 03 08 11 F
103 06 12 18 F
104 44 16 60 *

requirement is same as above marks awarded and end exam .....

I couldn't find what field should be used for this type of requirement.

please help me.

Answers (3)
0
srinath

srinath

NA 133 0 14y

Thank you for replying.

I tried the code which is given by Mr.Prasanta pradhan. I am getting problem when I use Edit Item Template for retreiving the data from database.

As in edit item template I need to bind the data from database with corresponding text property of the label in item template.

Please help me
0
Crish

Crish

NA 3.7k 76.4k 14y
hi

In gridview's header make  "Table" structure like

<table><tr><td colspan=3>Marks Awarded </td></tr>
<tr><td>End Exam</td><td>Sessional</td><td>Total</td></tr></table>



0
prasanta pradhan

prasanta pradhan

NA 144 0 14y
Hi Teams...

There are various approach for u r requirement one of them

====================
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
        <Columns>
         <asp:TemplateField HeaderText="Subject Code"   >
                        <ItemTemplate>
                          <asp:Label ID="lblsubCode" runat="server"  ></asp:Label>
                        </ItemTemplate>
          </asp:TemplateField>
         
            <asp:TemplateField >
            <HeaderTemplate>
            <table width="100%" border="1">
            <tr>
            <td colspan="3" align="center">Mark Awarded</td>
            </tr>
             <tr>
             <td>End Exam</td>
             <td>Sessional</td>
             <td>Total</td>
             </tr>
                         </table>
            </HeaderTemplate>
            <ItemStyle Wrap="true" HorizontalAlign="Center" VerticalAlign="Top" Width="150px"  ></ItemStyle>
                        <ItemTemplate>
                         <table border="1">
                               <tr>
                         <td>
                             <asp:Label ID="lblendexam" runat="server" Text="Label"></asp:Label></td>
                         <td>
                         <asp:Label ID="lblSes" runat="server" Text="Label"></asp:Label>
                         </td>
                         <td>
                         <asp:Label ID="lblTot" runat="server" Text="Label"></asp:Label>
                         </td>
                         </tr>
                         </table>
                        </ItemTemplate>
          </asp:TemplateField>
           <asp:TemplateField HeaderText="Remark"   >
                        <ItemTemplate>
                          <asp:Label ID="lblRemark" runat="server"  ></asp:Label>
                        </ItemTemplate>
          </asp:TemplateField>
         
        </Columns>
        </asp:GridView>
   
    </div>
    </form>
</body>
</html>
================

Thank's
Pradhan Prasanta Kumar
http://globaltouch.in