How can I add a dynamic row to a radgrid? - asp.net

I'm using the radgrid and I need to be able to add a row dynamically based on a certain condition. The table looks something like this:
|col0|col1|
|0,0 |1,0 |
|0,1 |1,1 |
|0,2 |1,2 |
But I want to be able to add pseudo-headers based on a condition:
|col0|col1|
|0,0 |1,0 |
|header |
|0,1 |1,1 |
|0,2 |1,2 |
The header row is not in the underlying data, I just want to add it if the condition is triggered. I don't think I can do this in the ItemTemplate itself, because I need to span all the columns, and this requires a separate table row. But I also can't find any way to accomplish it using code behind.
This seems so basic that I'm sure I'm missing something, but I don't know what it is. I'm also not at all attached to the idea of adding a row, if there's another way to accomplish what I'm trying to do.
Thanks in advance!

For posterity, I never found a way to do this, and ultimately threw out the RadGrid entirely and implemented the required layout with a repeater control that emits a table and rows, and I just emit an extra row for the header when necessary. I remain baffled that something so relatively straightforward does not appear to be possible with the RadGrid.

Related

Drupal 6 | Flexifields remove option

I've used flexifield module to merge two of my content types. There is an option to add an item while creating a node. I want to remove rows added. I've been searching and trying to get out of this problem but found nothing. What should be done to achieve this thing?
Thanks
Set all the field value as default. It will remove extra rows and by default it will give two sets of row.

Flex 4 How do I access a specific cell by index?

I would like to edit a cell by the row and column indexes so essentially do the following:
advDataGrid[2][3] = "Dogs"
so that I am setting the data grid row 2 and column 3 to Dogs. I cannot for the life of me figure out how to do this!
Side note: I need this because I am trying to allow the user to copy a section of an excel file to a section of an AdvancedDataGrid like Google Docs does. I am using this idea to do it: http://mannu.livejournal.com/348299.html
Thanks! Any help will be greatly appreciated!
In general you want to operate on the dataProvider rather than the presentation (AdvancedDataGrid). So in your case, I would get the item associated with the specified row from your dataProvider and modify whichever element is specified to "Dogs". So something like this: adg.dataProvider[row].someColumnData = "Dogs"
EDIT: "someColumnData" refers to whatever property you have set for the column to display. So when you defined your AdvancedDataGrid's columns, you set the 4th column to use the "someColumnData" property of the items in your dataProvider, and you want to change the value in the 4th column, then you'd set it as described above. Hope that clarifies things.
Flex components are data driven, so you should modify the data provider of the grid.
What if you want to edit specific individual cells, eg I want to to keep running totals of some cells in other cells, IE: as a user edits I update whole columns.
Surely their must be a way to walk the array and get Column4.row6 = something.

Change a value in a dynamically generated drop down list

Ok so I have drop down list connected to a datasource, and I need to change 2 or 3 of the values before they are displayed and I'm just having trouble figuring out what to do. I'm assuming I setup some kind of loop to check the values, but thats all I can figure. Does anybody have any general suggestions or resources they know that I can look up? Thanks.
You need to do your processing before you bind the datasource. So for example, create a dataset of results or arraylist, process the results changing your values and then bind to your dataset/arraylist.
You'll need to be more specific about what you are binding to and how you want to process for me to be more specific..
See link at http://www.c-sharpcorner.com/uploadfile/sd_patel/dropdownlistbox11222005064123am/dropdownlistbox.aspx

Edit first column of GridView

I've got very dynamic GridView and I need to allow to user to edit first column of it. After he edit first column of grid it must be updated on DataBase.
Is there any ways to handle it ?
My only idea is to put some changeable element to first cell of each Row so it must be able to set / get my values for each row but can't find yet any examples of it ...
Additional info :
GridView takes data from Object data source and all columns are dynamic (yes, maybe except first, but I add it in dynamic way) and load complete DataTable... \
Currently Using jQuery+Ajax methode on dynamic button but can't disable button's PostBack so with a PostBack it just disappears and dont make the event it must to make...
Since you have dymanic columns, for each column, specify the read-only property (If a column is read-only, it may only be looked at, and not edited when in the GridView's Edit-Mode).
So, the first column of would be readonly="false" (or omit it entirely) and the other columns read-only="true".

Databound Checkbox list with textboxes in a webform

I'm having trouble coming up with a solution for the following problem and i was wondering if someone here would help me out.
I need to pull a list of supplies from a db table and list them along with two textboxes (one for quantity, and another for manufacturer)
so the list would look something like this.
checkbox for supply 1 | Quantity | Manufacturer
checkbox for supply 2 | Quantity | Manufacturer
..
I also need to store all of the checked items in a db table.
I'm not sure how i should go about doing this. I've heard some talk about a repeater control being useful but i've not come across any examples that do this type of thing.
Thanks in advance
I've used the ListView for things like this, but Repeater probably woudl work too; simply create the ItemTemplate with these controls. On a button click, you can loop through the ListView.Items collection, using FindControl to find the checkbox, and if checked, get the textbox values.
It's pretty easy to setup.

Resources