Click here to Skip to main content
Sign Up to vote bad
good
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:54
yl2rox324


4 solutions

 hi ,
you can use loop .
 foreach (GridViewRow item in GridView1.Rows)
        {
            string test= item.Cells[2].Text;
        }
  Permalink  
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  
Use rowcommand event
 
 int index = Convert.ToInt32(e.CommandArgument);
                GridViewRow row = GridView1.Rows[index];
                lblassinmentno.Text = row.Cells[1].Text;
  Permalink  
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)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 443
1 Arun Vasu 381
2 OriginalGriff 345
3 Maciej Los 191
4 Aarti Meswania 190
0 Sergey Alexandrovich Kryukov 9,755
1 OriginalGriff 7,559
2 CPallini 4,018
3 Rohan Leuva 3,362
4 Maciej Los 2,951


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 21 Mar 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid