By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,467 Members | 1,308 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,467 IT Pros & Developers. It's quick & easy.

Have a probem in Editing in the row of grid view in a strange way?

P: 96
actually i want to edit the row of an grid view by code behind not using any sql data source. u know that that show edit button property in a grid view

when we set this property to true & simply connect it to the sql data source
we use a update command property in sql data source
by doing all this we create a such type of data grid in which
edit button is display in every row when u click on edit button then the corresponding row is opened in editable form. & update & cancel button is display when u hit on update button the value is updated & row is converted in noneditable form.....

Now i donot want to use edittemplate & donot want to add textboxes in edit template
& donot want to use sqldatasource
can we do the above thing by code behind just like i mention in the above details
by using such type of property which i discusses above
that we can open a row of an grid view in editable form without using edittemplate
& update the data from codebehind which value i mention in editable row.
Thank you
May 19 '10 #1
Share this Question
Share on Google+
6 Replies


Expert 100+
P: 750
PRR
Can you specify what exactly you want to do? You can handle the Gridview.Rowupdating event for Gridview and do the update. Obviously you need have TemplateField with EditItemTemplate.
May 20 '10 #2

P: 96
@PRR
you just add show edit button property in grid view & run the program Then grid view will display edit button in every row of an grid view i know that when you click on edit button there is an error because of unhandling the event.
u know that when i use sql datasource & use updatecommand property & write update query in update command & after that bind sqldatasource with grid view
after that you run your program & click on edit button then row is opened in editable form & updation is done....
Same functionality i want to use through code behind without sql datasource
May 20 '10 #3

Expert 100+
P: 750
PRR
Go to gridview properties and click on events... you need to handle the appropriate events.
Link
May 20 '10 #4

Frinavale
Expert Mod 5K+
P: 9,731
AnagJohari: Then grid view will display edit button in every row of an grid view i know that when you click on edit button there is an error because of unhandling the event
You do not have to use the SqlDataSource. I never do....
In fact I'm doing exactly what you want to do in several different projects.

I created a Web User Control used for display/editing purposes. This control is on the same page as the GridView but is invisible (Visible=false) so it's not rendered.

When the user clicks the edit button...it is handled by the method in my VB.NET code (this could be C#...same difference) which retrieves the data from the row selected for editing and uses that to populate the Web User Control with information. After the Web User Control is populated, I set the GridView.Visible=False and my Web User Control.Visible = True.

Now the GridView is hidden and the user sees the editable details.


I use this technique because the GridView only displays general information and the Web User Control displays all of the information about whatever the user is working with.

So, please look at the link that PRR posted.
It explains how to Handle the Editing event.

Then consider what I said and give it a try.

-Frinny
May 20 '10 #5

P: 96
@Frinavale
your mean i create such type of webcontrol in which when you hit a perticular row in a grid view then grid view is disappear & that perticular row is displayed in editable form with the stored data & after doing changes in that perticular row that editable row is disappear & the grid view with updated that row will appeared.
i want to use a grid view also for that editable row in which we do changes
That thing you explain me.......
May 20 '10 #6

P: 96
@PRR
now i have completed all this by handling event. but i want this in diffrent manner as frinny mentioned
May 20 '10 #7

Post your reply

Sign in to post your reply or Sign up for a free account.