• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1132
  • Last Modified:

GridView Row

Can any body tell me how I can do this.

I have made a custom template field in my grid view, this contains a button which links to a function in the code.

here is the small function

    protected void Process_Click(Object sender, GridViewRowEventArgs e)
    {
        String value1 = e.Row.Cells[3].Text.ToString();
        value.InnerHtml = value1;
    }

But I cannot get it to work and get this error

Error      1      No overload for 'Process_Click' matches delegate 'System.EventHandler'      C:\Documents and Settings\REA_A\Desktop\test\c_sharp_tests\WebSite2\Default.aspx      39      

Thanks in advance,

ANdrew
0
REA_ANDREW
Asked:
REA_ANDREW
  • 4
  • 2
1 Solution
 
REA_ANDREWAuthor Commented:
is there an easier way to get a cells value on a certain row dependant on the button I click?
0
 
Ramesh SrinivasTechnical ConsultantCommented:
I think you have to create a handler for the button click event.


Something like:

NameOfYourButtonHere.Click += new EventHandler(this.Process_Click);


I think that is it anyway :O
0
 
REA_ANDREWAuthor Commented:
I am having trouble with that, as the intellisense is not recognising My button at all. I was going to put that code in the Page_Load handler
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
GavinMannionCommented:
Create the event handler for GridView.RowCommand and then put your code in there.

Buttons inside a GridView are duplicated depending on how many rows you have so you cannot pick up the button on_Click only that the Row has sent a command.

Take a look and let me know if you need more help.
0
 
REA_ANDREWAuthor Commented:
I used a work around for now but I will try that too.  My problem now is that one, I use a command field that selects the row.  This is how I have got My row number.

My first column is hidden, BUT i need its value.  I have assigned the columns data keys but I do not know how to retrive these, say if I use  GridView1.SelectedRow <-----DataKeys is not a memeber of this.

Can you help>

Thanks so far guys

Andrew
0
 
GavinMannionCommented:
Since you have your RowNumber you should just be able to do something like

GridView1.SelectedDataKey["MyKey"]
0
 
REA_ANDREWAuthor Commented:
Cheers Again Gavin, That sorted spot on.

Cheers
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now