Displaying 2 rows as one row in GridView--very urgent

Hi

I need to display 2 rows as a one row in Gridview like this in text boxes and also I need horizontal paging on the gridview...

any help would be much appreciated !!!

---------------------------------------------------------
<<  Jan| Feb| Mar| Apr| May| Jun| Jul|   >>
---------------------------------------------------------
  A  10 |  20 |  30 |  40 |  50 |  60 |  70 |
  B  10 |  20 |  30 |  40 |  50 |  60 |  70 |
  ----------------------------------------------------|
  A  11 |  22 |  33 |  44 |  55 |  66 |  77 |
  B  41 |  42 |  43 |  44 |  45 |  46 |  47 |
  ----------------------------------------------------|
 

 

0
yogi_virgin
4/13/2009 3:16:31 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

5 Replies
838 Views

Similar Articles

[PageSpeed] 25

Convert your Column to Template and add two TextBoxes there like:

 

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" >
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server"/> <br />
                    <asp:TextBox ID="TextBox2" runat="server"/>
                </ItemTemplate>
            </asp:TemplateField>    
        </Columns>
</asp:GridView>
  

 


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
4/13/2009 3:45:27 PM

You will have to create a custom pager to get that particular effect. 

If you want to group data in a gridview you could check out this tutorial.

http://www.asp.net/learn/data-access/tutorial-27-vb.aspx

Otherwise you could create a stored procedure returning data just as how you show.  For example if A is 2009 and B is 2008 you can return both those years data and group by the year in your SP then display it all in one gridview row using template fields.  Or you could use a datalist or listview.


View Brenden Kehren's profile on LinkedIn
Remember to mark as answer if this post answered your question.
0
b471code3
4/13/2009 3:53:33 PM

--------------------------------------------------
<<  Jan | Feb | Mar | Apr | May | Jun | Jul | >>
---------------------------------------------
  A  10 |  20 |  30 |  40 |  50 |  60 |  70 |
  B  10 |  20 |  30 |  40 |  50 |  60 |  70 |
--------------------------------------------|
  A  11 |  22 |  33 |  44 |  55 |  66 |  77 |
  B  41 |  42 |  43 |  44 |  45 |  46 |  47 |
--------------------------------------------|

I suggest that you solve the problem as follows:

  1. Make an HTML Mockup of the page you want.
  2. Simplify the markup with CSS as much as possible
  3. XHTML validate it using the W3C tests at http://validator.w3.org/
  4. Use the HTML Text Writer at http://www.codeplex.com/HtmlTextWriter2 to convert this into either C# or VB.NET static code.
  5. Convert this static into dynamic code
  6. Inject the dynamic markup into a span by SpanInsert.InnerHtml = "....";
<span runat="server" id ="SpanInsert">REPLACE ME</span>

Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
0
TATWORTH
4/13/2009 4:09:38 PM

can you please post any code snippets

0
yogi_virgin
4/14/2009 10:30:22 AM

 Have you downloaded the HTML Text Writer?

If you download the CommonData solution from http://www.CodePlex.Com/CommonData, in the CSWebApp, Default.aspx.cs contains an example of table creation.

  /// <summary>
  /// Returns string for display
  /// </summary>
  /// <returns>String for display</returns>
  private string Writer()
  {
    var builder = new StringBuilder();
    builder.Append("<table width=\"100%\">");
    builder.Append("<tr>");
    builder.Append("<td>1</td>");
    builder.Append("<td>2</td>");
    builder.Append("<td>3</td>");
    builder.Append("<td>4</td>");
    builder.Append("<td>5</td>");
    builder.Append("<td>6</td>");
    builder.Append("<td>7</td>");
    builder.Append("<td>8</td>");
    builder.Append("<td>9</td>");
    builder.Append("<td>10</td>");
    builder.Append("<td>11</td>");
    builder.Append("<td>12</td>");
    builder.Append("<td>13</td>");
    builder.Append("<td>14</td>");
    builder.Append("<td>15</td>");
    builder.Append("<td>16</td>");
    builder.Append("<td>17</td>");
    builder.Append("<td>18</td>");
    builder.Append("<td>19</td>");
    builder.Append("<td>20</td>");
    builder.Append("<td>21</td>");
    builder.Append("<td>22</td>");
    builder.Append("<td>23</td>");
    builder.Append("<td>24</td>");
    builder.Append("<td>25</td>");
    builder.Append("<td>26</td>");
    builder.Append("<td>27</td>");
    builder.Append("<td>28</td>");
    builder.Append("<td>29</td>");
    builder.Append("<td>30</td>");
    builder.Append("<td>31</td>");
    builder.Append("<td>32</td>");
    builder.Append("</tr>");
    builder.Append("</table>");
    return builder.ToString();
  }

The markup is:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>Untitled Page</title>
  </head>
  <body>
    <form id="form1" runat="server">
    <fieldset title="A Title">
        <div id="divReplace" runat="server">
    </div>
    </fieldset>
    </form>
  </body>
</html>

The assignment is done by:

  #region Page_Load
  /// <summary>
  /// Handles the Load event of the Page control.
  /// </summary>
  /// <param name="sender">The source of the event.</param>
  /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
  protected void Page_Load(object sender, EventArgs e)
  {
    divReplace.InnerHtml = this.Writer();
  }
  #endregion


Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
0
TATWORTH
4/14/2009 11:47:10 AM
Reply:

Similar Artilces:

Add new controls to a gridview row; when editing that row using the edit row feature in the gridview control.
Hi all  I have a questions that looks hard / complex to me, and i know you can help me in this. Q {  I have row in a Gridview and i have an edit option to it. I press the edit button, to edit the values in that row and update data all the way back to the database. Now when i press the edit button, i want a drop down list to be displayed that contain values for a particular field in my grid view. (for now only plain text boxes appear.) } I hope you understand my question, all i need to do is replace the text box controls with a dropdown list when i am editing a row in ...

Reduce rows displayed but putting 3 rows in one row
Hi all, I'm using PB6.5. I have an SQL DW that fetch some information from the DB but should display only two columns: a code and a value. Also they are displayed in the trailer of a group if that's actually important. In order to reduce displayed rows count, i would like to display each 3 rows in one row(Code,Value,Code,Value,Code,Value). The question is how can i do that?. I've tried to use computed fields and in the second and third pair values to use code[1],value[1],code[2],value[2] but only the code[1],value[1] are OK(Showing next row's data), the third ...

Error with Gridview when i delete the row that have only one row in gridview
 Dear all, i develop with asp.net 2005 and use gridview and set enable deleteing =true. I can delete record in gridview properly but when gridveiw has only one row and then i'm clike delete button , the error occurs :   Server Error in '/it' Application. Specified argument was out of the range of valid values.Parameter name: value Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentOutOfRangeExce...

How to display the more than one row with items and buttons in gridview control. when i select three items at same time from categories(Fruits, Apples, Gifts). The selected items are displayed in g
Hi,when i select three items at same time from categories(Fruits, Apples, Gifts). The selected items are displayed in gridview.Here i would like to change this way "when i click more than one category at same time. it should be display selected item and button."For example: if i have to select Fruits, Apples from categories.  it should be display like 1st "row have Fruits and In 2nd row have Apples and button" in gridview.the button have some event.How can i do it? Please can anyone answer me.With kind requestThanks your query is very raw..can u details it out...Pl...

2 gridviews on one row, problem with render for double click function on a grdiview row
Hi, I have an application with 2 gridviews on one page. On the first gridview (GridViewRequests) I have a function to double click on a row, when I double click a detail screen opens where I can edit the data of the selected row. Now I want the samen function on my second gridview (GridView1). I was thinking this should go easy because I can simply copy the code from the first function en change the names to my second gridview. But I have a piece of code which I can't duplicate. Can I solve this in another way?? It's this code: Protected Overrides Sub Render(ByVal writer As HtmlTex...

new row below selected row in gridview to display child gridview
Hello,   I have a gridview that up selected..shows the nested child grivdview. The problem I currently have is that it stuffs all the data into a column whcih blows the whole tbale out of whack. What I need to do is create a new row below the sleected row to house the new child grivdview. I have seen third party controls do this such as teleriks radgrid but I wont to do this with the gridview control.  Any articles on how to do this? Does AJAX support this? Any help is greatly appreciated.    ...

Help need in gridview to display one row initily and add the new row at runn time
Hi,    Am creating the Gridview in that i put to HTMLSelect control and i populate item value from the database in ItemTemplate. Now i want to display only one row initily with the two HTMLSelect Control and if user want new row the can add by click the addnew row button. How to go with this...? I dont know how to Display only one row initily and add the new row at the end of the item template at the run time can any one help me.   Thanks Hi Spider.net, The GridView rows collection's Count property is equals to the row number in it's datasource. If...

How to get two gridviews in one cell of a row in .net 2.0
Hi I am trying to display two gridviews in a row using datalist.  This is how my code looks <asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal" DataKeyField= "GroupID" RepeatColumns="2" OnItemDataBound="DataList1_ItemDataBound">                              <ItemTemplate>              &nb...

Help! Find row on which a button was pressed in the gridview control in .NET 2.0
How do you get the exact row (and column data from that row)  on which a button was pressed within a gridview. In .NET v1 using the datagrid control the followingconstruction was available:objArgs.Item.Cells(n).Textusing the datagrid DataGridCommandEventArgs parameter. choices in gridview are     Sub cmdBackTestSummary(ByVal objSender As Object, ByVal objArgs As GridViewCommandEventArgs) ' objArgs.commandname ' objargs.commandarguement ' objargs.commandsource     End Sub but no objArgs.Item.Cells(n) So how do you get the exact row (and c...

Adding row (one at a time) in gridview on a button click. And cells of added row should contain controls like DROPDOWN LIST or TEXT BOX.
Dear Friends, I am in great need for the solution/hints/guidance of my requirement, if anyone can help with.  Let me explain what I need."I need a Gridview control on a webpage having following 5 columns/fields.     Column 1: It just has a "+" button in its header only (other cells for this column is empty)    Column 2: The Column header here is "FIELD" and  it should contain dropdown list (which is populated from some database)    Column 3: The Column header here is "Operator" and  it should ...

Data Controls insert rows into gridview then insert rows from gridview into SQL Table
Hello there, I'm still new at performing miracles with code . Currently I am having trouble with my latest coding adventure I have a web application which records jobs and labour assigned to jobs. The issue in particular I'm having is the way in which labour is to be assigned. I want to use standard controls (Textbox, Dropdownlist) to record the values into a gridview (ie,put multiple rows into the gridview using the controls). Then, when all the inserting is complete, the user clicks a submit button to insert all the rows from the gridview into a database table. The reason for...

Update GridView and display to client row by row
 Hi, I am working on a website in which I have to display the data using gridview. The requirement is initially the gridview will be displayed with certain data. Later when user clicks abutton then we need perform a complex operation on each which will take some time. Once the operation is completed we need to update the gridview with operation results.This process should done for all the rows in the gridview. Right now if the user clicks on the button the operation is being performed on all the rows and all the results are in the gridview at once. For all the operation to be ...

gridview show mulitple rows in one row
I want to show an overview of users, with all classes they have attended and from which year to which year.My userdata is in tblUsers, the info on classes they have been in is stored in tblClassesEach user may have attended 0 to 12 classes.My SQL query returns a row with userdata for each class a user has attended (which is supposed to work like this).Now in my gridview I want to show 1 row PER user and in that same row I want to show all classes that were attended...How can I achieve that?So I might well have 10 rows returned for user Peter, but I want to have one row in my gridview that sh...

I want to display data column names in more than one row in gridview for display
    Name   Age    Address data    data   data Phone    Mobile data       data I'm thinking a GridView is probably not the best approach for what you want to do. Instead, I'd probably use a Repeater as my parent control, and then use either embedded GridViews or a UserControl which contains GridViews in it.Thanks, EdMicrosoft MVP - ASP/ASP.NET...

Web resources about - Displaying 2 rows as one row in GridView--very urgent - asp.net.presentation-controls

GridView SelectedItem Binding Gotcha in WinRT
Last night when I was doing some WinRT hacking I was trying to setup databinding to the selected item in the GridView control and I ran into ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Advanced Search Gridview Latest News Releases All ...

CNW Group
... Services Beyond the Wire About CNW my CNW CNW Access CNW Directories Financials Webcasts Events my CNW All News Releases Advanced Search Gridview ...

CNW Group
Home Services Beyond the Wire About CNW Financials Webcasts Events My CNW All News Releases Add a Filter Gridview Latest News Releases All Today ...

New CmdLets of Powershell 2.0
New CmdLets of Powershell 2.0

Price Drop: Softbox
... objects- create product reflection- changing the background with something more interestingUse it as:- softbox- honeycomb softbox- gridview ...

Profile.aspx: ASP Alliance
.NET,ASP,ASP.NET,SQL,XML,HTML,ADO,ADO.NET,JavaScript,JScript,CSharp,VBScript and VB tutorials from AspAlliance.

Quick Answers - CodeProject
Questions - Free source code and tutorials for Software developers and Architects.; Updated: 25 Oct 2012

DotNetKicks.com - Upcoming stories
DotNetKicks.com is a community based news site edited by our members. It specialises in .NET development techniques, technologies and tools including ...

View Features - ExtendASP
Call 847-681-9827 or Request a Demo View Features Testimonials Pricing About Us Coming Soon ExtendASP exposes every feature, more than any other ...

Resources last updated: 12/4/2015 4:48:02 PM