I have binded data in RadGrid. I want to check multiple checkboxes and value inserted in textboxes in grid column should be inserted in database though single button based on checked checkboxes.
is it only possible through foreach loop and findcontrol in it. Please Help keeping performance of grid in mind.
Thank you very much
Related
I have a GridView. Everytime there is a mouse over on an Id in the gridview I want to display additional information with multiple rows in the form of a table or gridvew. I'am currently working on asp.net C#. Any help is highly appreciated.
I want to do something really simple, I just can't seem to find the EnableClientAddRow property, so I can set it to true. I have a standard GridView control on a web form. I want a button to appear on the web form. When the user clicks the button, an empty row is added to the GridView UI, so the user can enter data in the appropriate fields. The row will of course, have a "Save" button of some type in one of the columns.
I know this functionality must be in the GridView somewhere, I just can't find it. I did find some odd hacks that try to manually implement this. I'm not really interested in footer manipulations or binding tricks, just the standard add row method.
EDIT:
It appears the GridView does not support adding a row as a first-order operation. This appears to be a serious design flaw.
I typically add a new record to the underlying data source as a part of the "add record" button click action. I then re-bind the view in order to show the blank row.
The new record is typically a DataRow if the GridView is bound to a DataTable, or an object if the GridView is bound to a collection of a particular type. Not sure if that is what you consider a binding trick from your question, but it works well and is quite easy to implement.
Edit - more detail to describe the process:
Add the row to the data source, set the EditItemIndex to the newly added row in order for the row to enter edit mode, then bind the data source to the GridView. Your EditItemTemplate would contain a Cancel and a Save button. Cancel would re-bind the GridView to the underlying data source without the empty row and set EditItemIndex to -1, thereby removing the row from the GridView.
How to easily insert row in GridView with SqlDataSource
If you add a new row to the datasource, even if the row has empty values, and you databind the datasource to the Gridview, it should show up as an editable row just like any of the other rows.
I am using a gridview in my form.aspx page. The textboxes in each row of the gridview are to be populated from a datagrid upon clicking a particular field of the datagrid. Is there any way to do the same.....?
Did you check out some of the samples the ASP.NET website? Maybe this one can help?
Gridview quickstart on ASP.NET
Otherwise I suggest you describe your problem in greater details. What's the datasource? Anything specific you can't figure out right now? Are you getting any exceptions?
I have created a GridView whose columns are dynamically created based on my data source. I have implemented these columns by using the approach described here.Those columns display properly on the initial load. However, I need to implement commanding so that a user can edit / delete a row in the GridView.
At this point, I have implemented commanding as I would with a normal GridView. I have a TemplateField with an ItemTemplate that has LinkButton elements for edit and delete. The CommandName for each LinkButton is set to either Edit or Delete respectively.
Oddly, when a user clicks either the Edit or Delete link, the data in the GridView disappears. However, I have verified that I am in fact re-binding the data when one of these LinkButton elements is selected.
Can anyone provide some suggestions as to what the cause could be?
Thank you!
Here are good examples. You can figure out postback issue.
http://quickstarts.asp.net/QuickStartV20/aspnet/
I have a Gridview in which no rows populated initially. means i am not setting any datasource to gridview.I have to populate gridview by adding footerrow.I have given visibility of footerrow as true.So one error is coming as 'Object not set to an instance of an object'.what may be the reason for this? Can anybody help?
Actually i need to add data into the Gridview through the FooterRow.After inserting a few records,i need to insert this data into the database.So, i want this Gridview only to insert data into the database.For a particular "FileID", i have many records,thats why i am using Gridview.Is there any other method for this?
See this question: How to insert a Row in GridView.
The object reference error is probably because you have set no datasource for the GridView. In such cases, the Gridview will not render.
Edit:
I have already linked to another question which provides a very useful link to accomplish the type of functionality you desire. Since you appear not to have found it, here is the relevant link - How to easily insert row in GridView with SqlDataSource?
The article shows how you can use the EmptyDataTemplate of the GridView to enable record insertion using a GridView. Note that you will have to modify the logic a little to insert a group of records in one go, rather than one at a time.
If you have a problem with this solution, please clarify via comments.