Solved

Using a custom edit in a gridview

Posted on 2008-10-19
3
765 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

733 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