Solved

Using a custom edit in a gridview

Posted on 2008-10-19
3
761 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
Comment Utility
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
Comment Utility
This helped out a lot. Thanks for your help.
0
 
LVL 16

Expert Comment

by:Gyanendra Singh
Comment Utility
yr welcome
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Refresh Datagridview from another form 1 25
Code enhancement 5 12
Response.Redirect Open new Form/tab/page? 5 17
Asp.net mvc 5 5 13
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

9 Experts available now in Live!

Get 1:1 Help Now