Gridview row-by-row rendering

Hello guys,

I have a bit of a dilemma. I have a Gridview control and I want it to be rendered row-by-row on the page.

I tried to do it this way:

protected void myGv_RowDataBound(object sender, GridViewRowEventArgs e)
{
	StringBuilder renderedOutput = new StringBuilder();
	StringWriter strWriter = new StringWriter(renderedOutput);
	HtmlTextWriter tWriter = new HtmlTextWriter(strWriter);
	e.Row.RenderControl(tWriter);
	Response.Write(renderedOutput.ToString());
	Response.Flush();
}
But this is totally wrong because IE doesn't render a table until the end tag is provided. 
Do you have an idea that can really work? 
  
Well, those aren't for New Year's. Those are my everyday balloons.
0
morsanu
11/28/2008 10:12:56 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

7 Replies
645 Views

Similar Articles

[PageSpeed] 23

Use a Repeater, and write the data to divs.

 


Regards Mike
[MVP - ASP/ASP.NET]
My site
0
Mikesdotnetting
11/28/2008 12:22:14 PM

 or print on screen everything by yourself, with foreach

in some scenarios this is handy technique, especially if your print element is a usercontrol :)


Marko
0
marko_vucinic
11/28/2008 1:48:36 PM

Hi morsanu,

You can set Visible of that row to true and other rows to false to render one row. Hope this article can give you some idea: http://blog.evonet.com.au/post/2008/06/Gridview-that-exports-selected-rows-to-Excel.aspx

Thanks,


Qin Dian Tang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Qin
12/2/2008 9:04:45 AM

Mikesdotnetting:

Use a Repeater, and write the data to divs.

 

I must use a Gridview.


Well, those aren't for New Year's. Those are my everyday balloons.
0
morsanu
12/8/2008 12:07:31 PM

marko_vucinic:

 or print on screen everything by yourself, with foreach

in some scenarios this is handy technique, especially if your print element is a usercontrol :)

 

I don't think you read my post with atention. I tried to write by myself, but IE has a problem with showing tables before renderind the </table> .


Well, those aren't for New Year's. Those are my everyday balloons.
0
morsanu
12/8/2008 12:09:11 PM

Qin Dian Tang - MSFT:

Hi morsanu,

You can set Visible of that row to true and other rows to false to render one row. Hope this article can give you some idea: http://blog.evonet.com.au/post/2008/06/Gridview-that-exports-selected-rows-to-Excel.aspx

Thanks,

 

I don't need to hide any rows I just need to show all the rows one by one on the page.


Well, those aren't for New Year's. Those are my everyday balloons.
0
morsanu
12/8/2008 12:10:44 PM

morsanu:
I don't think you read my post with atention. I tried to write by myself, but IE has a problem with showing tables before renderind the </table>
 

This should help: http://msdn.microsoft.com/en-us/library/ms533002(VS.85).aspx#layout

 


Regards Mike
[MVP - ASP/ASP.NET]
My site
0
Mikesdotnetting
12/8/2008 1:52:10 PM
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 ...

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...

Gridview with multiple header rows
Hi, I have just installed the CSS Friendly Control Adapters and now my gridviews are not displaying dynamically added header rows. Code for adding rows is like so: Dim headerCell As New TableHeaderCellheaderCell.ColumnSpan = gridview.Columns.Count headerCell.Text = headingDim rowHeader As New GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal) rowHeader.Controls.Add(headerCell) CType(gridview.Controls(0), Table).Rows.AddAt(0, rowHeader)   This is typically used for adding a nicely formatted heading row and it is a requirment that i must have this extr...

Selecting a gridview row and keeping the last selected row in a gridview highlighted after mouse moves over a new row.
What is the best way to show a gridview row highlighted once selected and keep it highlighted once the mouse moves over a different row? Thanks, Steve hi,you can use <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="#FFFFFF" /> plz let me know if i misunderstood you Thanks for your help. One problem; however, is that after the row has been selected and I check the "grid.SelectedIndex" it has a value of -1 and not the index of the row that was selected on the grid. What do you recommend? Thanks, Steve hi, sorry i din...

Gridview row click event fires, when clicking on controls within row.
I have a gridview control and I have added  a row click event which causes a post back. e.Row.Attributes.Add("onClick", this.Page.ClientScript.GetPostBackEventReference(this, "Select$" + e.Row.RowIndex.ToString()));  When the user clicks the row, i bind some data to a checkbox list, showing a uers a list of options they have chosen. All good so far. I also have a edit button for each row. When the row is in edit mode i display a checkbox and textbox. Problem is when i click on the textbox or the checkbox, it causes the row click event to fire. Any ida...

How to delete row from GridView control
Hello,  I am working on an ASP.NET 2.0 app, and I am trying to wire up a "Delete" button to a gridview control on a form. Here is the code for the ASP :  <asp:GridView ID="gvInConditions" runat="server" AutoGenerateColumns="true" OnRowDeleting="gvInConditions_RowDeleting" DataKeyNames="Condition_ID" >         <Columns>                <asp:CommandField ButtonType="Button" SelectText=&...

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...

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...

Showing/Hiding Rows in a Gridview control in Render Event
Hello, I'm using a Gridview control and need to be able to hide or show a row in a Gridview control in the Render event of a Content page.   Is there an easy way to do this? There is a <asp:LinkButton> on the Master Page that indicates either to Show or Hide error messages.  When I used the following code, it hides all rows.                 foreach (GridViewRow row in inGridView.Rows)                { &nbs...

Gridview.Rows.Count not incremented after call to GridView.Rows.AddAt()
Hi All, I've got a grid view that was created from a static DataTable.  I then wish to add a row to the gridview.   However the GridView.Rows.Count does not increment after I add a row to the underlying Table extracted as gv.Controls[0] as Table.  I need the gridview to maintain the correct number of rows because a post processing routine then accesses the newly addrows throught the gridview.Rows[i].Cells[j] calls. Thanks, cr  static protected void AddRow(GridView gv, out string sOut) { Table t = gv.Controls[0] as Table; GridViewRow r = new GridViewRow...

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.    ...

First Row, Next Row, Prior Row, Last Row
I have a SQL Anywhere 7.0 Database, have a table Product_detail which contains Column Name Datatype width Null Default batch_id char(10) No None prod_id Integer No None employee_id Integer No None quantity Integer No None price Numeric (14, 2) No None Its primary key is batch_id I have a Freeform Datawindow with this table I want to provide the first row, next row, prior row and last row Ho...

GridView.Rows(Column=ID_PK) to GridView.Rows(Column=DropDownListTeamplteField)
Hi Guys,I wonder how I can assign the PrimaryKey in each GridView Row to the template field in the same row. whereas the template field is filled with a dropdownlist thatshould show the values for retrieved in a different table through the GridView Row primary key (which serves as the SELECT parameter to get these values) The GridView looks like this:<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="C_ID" DataSourceID="GetC_IDs"> <Columns> <asp:BoundField D...

How to find a outer gridview row when a button in inner gridview row is clicked
Hi, I have a gridview within a gridview. In the inner gridview, I have a column of imagebuttons. I cannot figure out how to find out the row of the outer gridview when I click on the imagebutton in the inner gridview. I modifies the code below to get rid of some of the unnecessary stuff. <asp:GridView ID="SitePrepMainGV" runat="server" DataKeyNames="SitePrepItemID" DataSourceID="SitePrepMasterDS" OnRowDataBound="SitePrepMainGV_RowDataBound" OnRowEditing="SitePrepMainGV_RowEditing" OnRowCreated="SitePrepMainGV_RowCreated"> <Columns> <asp:BoundField DataField="S...

Web resources about - Gridview row-by-row rendering - asp.net.presentation-controls

Sifting Through An iPhone's Geo Data, Row By Row
NPR's senior director of technology digs into the Geo Data that is captured and recorded in iPhones and iPads.

Resources last updated: 12/25/2015 2:40:22 PM