Forms Data Controls ::working On Setting Up A Gridview That Dynamically Creates New "columns" After A Set Amount Of Rows?
Mar 10, 2011
I'm working on setting up a Gridview that dynamically creates new "columns" after a set amount of rows. To do this, I bind a datasource to the Gridview and then add new cells and shift the other items into those cells. I seem to be having an error with the link buttons that I move around. All of the items get put in there correct location, but for some reason, when I click a link button that has been added to a new cell, the sender's text is the LinkButton in the original cell's text. Does anyone know why this would be happening? Is the gridview not meant to be manipulated after it has been data bound? This is the code that I use to update the gridview.
I'm binding a gridview from a webservice with 30 columns and 10 rows, I need to print the same in a PORTRAIT, for that i decided to display columns as rows and
I am working with GridView, When huge amount of Data is inserted in the GridView its columns became very thin all tall, however I want to Display the Gridview with Fix size and if the Data is hugeit only display the starting few words of Data.in other words I want to use gridView same like the GMAIL account where Data Display like this. .
Need row editing on page_load for all the cells and need to validate each cell entry. Means cell1 one entery isvalid it fills thrid cell and insert or update to a table in the database. How do i handle on tab clicking to update in databse.
I have a GridView with bound columns, for which I am manually setting the ItemWidth and HeaderWidth to 500px, and nothing happens. Is there some trick to getting this to work?
This is a column a large amount of text in it, and it keeps sizing to the width of the header text, which is simply "note". I don't want to set Wrap to false, becuase then the colummn could be thousands of px wide in cases.
I have a couple of things that are not working with my Gridview:
1) I've managed to display 3 columns in one column (see code above) but the data is separated by commas, how can I display each data item in separate rows.
2) How can I make the data unique, as I have added the distinct command which I configured in my SQL data source
3) I need the rows to not display nulls, but at the moment it isn't displaying the row if one of the columns is null?
I have gridview which auto generate column is false, and I add some template columns, databind with a class ClassA . it works fine. now, I need add some columns to this gridview. the problem is: I do not know the # of columns that will be added (it is dynamic), and the data with these columns is in ClassA, but it is a array (or list). so, there is no public property for these data, only the array.
now, what I did is: I dynamically add template column to the gridview (column header ...), so, it shows the correct columns in the gridview, but how can I bind the data? I found some example, i.e.
[URL]
but it is for aleady know the data field (which is a public property in the class). all I have is just a array, and I need bind them to the newly created columns in sequence.
Is tehre anyway to set the HeaderText dynamically on a gridview? I'm trying the below, it kind of works, but the problem is on the initial load nothing shows up, but when I postback then the new text populates: grdvMyTest.HeaderRow.Cells[5].Text = GetTheCalculatedDate();
I've tried that in both Page_Load and grdMyTest_Load, but same thing happens in both. When the page initial loads the column header text is blank, when I click something causing a postback it pops up. I don't have a IsPostBack check around that line, so it should be running regradless. I'm guessing I'm doing it at the wrong event, either too eariler or too late.
I created a gridview that is made up of 4 gridviews and using a stored procedure to populate it. I create columns at runtime because the number of columns changes all the time.To make the grids editable I am adding template fields at runtime as I create the columns, this is to ensure that a user is able to edit the cells and some foot values update. Reason why I have four grids is to freeze rows and columns like in excel using javascript. The problem is that performance is very bad especially in IE, the grids take a long time to load. I am not sure if this is caused by the data load or the creation of text boxes. see some of the code below for my _aspx page:
I want to create columns in gridview dynamically based on rows in a table and each gridview colum should have a checkbox. When I Click the save button, I want to save the checkbox state. How Can I do this ?
I need to load n number of rows to a gridview without data binding.. I am assisgning the values to the gridview.Rows[i].cells[0].Text="value" . at this time i need to increment the number of rows in gridview based on the number results ...
I have been searching for some time on the net for guidance on this question. Finally thought I will ask here...
I have a gridview that needs to be generated from code behind. There is a column with a name field and the remaining columns give the different user-ids linked to that id. Like this:
-- NAME, ID1, ID2, ID3......
The Name column will be populated from a table that has the Name as well as number of ID's associated with that name. eg [Name1][3]
I need to display linkbuttons that link to user-id related documents in columns 2 to n for each name.How do I dynamically add linkbutton columns from code behind?
I have been looking at this article: [URL] However, I have a question: Can't this be used with a sqldatasource, instead of binding the gridview behind? If so, how?
i had write and modified a code in your previous post
[URL]
now i want insert the data in SQL Server 2008 database, but show an error.
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Collections; using System.Configuration; using System.Web.Security; using System.Web.UI.WebControls.WebParts;
I follow this code [URL] it works. But the example is show only for 1 row.. come to my case when user want 12 rows for the first time gridview row load. I manage to add it by using for loop. but i stuck at the how to set previous data when user add new row to 13th row. The gridview seems like refresh and the entered data is gone!