Solved

Using a custom edit in a gridview

Posted on 2008-10-19
3
763 Views
Last Modified: 2013-11-07
I am using a gridview where it lists all of the listings by the current user. I also want to give the user the ability to edit that listing as well. I am using a link button to be able to accomplish this.

What I want the link button to do is have the user directed to another web page that will display all of the information about this particular listing and give him/her the ability to edit any particular part of that listing. Once that is complete, he/she is directed back to his "home page".

Where I am having problems is I am unable to put in the code that is necessary to accomplish this. I am hoping someone here can guide me in the right direction.
0
Comment
Question by:smitty68521
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
Gyanendra Singh earned 500 total points
ID: 22755364
See for achieving your result there is 2 way
1.  you need to set the datakeynames property in yr gridview and on grdiview editing event you need to retrive datakey and pass it through querystring in another page

2. go to LINK button propeties....... (i think its Button (link type)

like ....(right click one gridview ---> smart tag----->.EDIT Coloumns---->

 editlink button properties  ( set the COMMANDNAME as Edit)

now ur code behine window

at the GRIVIEW rowcommand event

protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
{

if (e.CommandName == "Edit")
{

   int index = Convert.ToInt32(e.CommandArgument);
  GridView customersGridView = (GridView)e.CommandSource;

   GridViewRow row = customersGridView.Rows[index];
     response.redirect("URaspxname.aspx?querystringname1=row.Cells[urNeedCELLNO].Text.Trim()&querystingname1=row.Cells[urNeedCELLNO].Text.Trim());


}
}

0
 
LVL 1

Author Closing Comment

by:smitty68521
ID: 31508102
This helped out a lot. Thanks for your help.
0
 
LVL 16

Expert Comment

by:Gyanendra Singh
ID: 22764518
yr welcome
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now