Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hello,
 
I have added a GridView to my web form and I want to retrieve a value from it during runtime.
 
The gridview is located inside an UpdatePanel. I set the AutoGenerateSelectButton property to true. But when I click on an auto generated button it doesn't fire any events. The buttons are like disabled but they are not.
 
Please help me to resolve this.
 
Thanks in advance.
Have a nice day!
Posted 20-Mar-12 21:54pm
yl2rox324
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

 hi ,
you can use loop .
 foreach (GridViewRow item in GridView1.Rows)
        {
            string test= item.Cells[2].Text;
        }
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

foreach (GridViewRow item in GridView1.Rows)
       {
           string str= item.Cells[i].Text;
       }
 
Or
you can add a ItemTemplate to Rows and add a Button to Template.Add Bind the parameter "CommandName " and "CommandArgument".
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Detail")
            {
                e.CommandArgument.ToString();
            }
}
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Use rowcommand event
 
 int index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row = GridView1.Rows[index];
                lblassinmentno.Text = row.Cells[1].Text;
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Hiiiii !!!!!!
 
I can understand your question. But think about what is the purpose of updatepanel?
Updatepanel is ajax control. So ajax control not post back any data to server. That's why your button does not work. if you are not using updatepanel that your gridview event should be fire and data post back to server.
 
Your simply answer is that you should fine some java script for call update panel event.
 

 

 

 

 
Thank You.
Patel Azharuddin
Software Engineer.
India
Phone: +919998392908
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.140926.1 | Last Updated 21 Mar 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100