Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone..
kindly help me in resolving my issues
I have a problem in rowcomman and paging. i have a page with maximum size is 5.
like below when i click on 2 it works well but when i click on 1 it will show me an error
Quote:
1 2 3 4

Quote:
Error:Index was out of range. Must be non-negative and less than the size of the collection


What I have tried:

I Have Tried This:
C#
protected void GridView_View_Notification_RowCommand(object sender, GridViewCommandEventArgs e)
    {
     int index = Convert.ToInt32(e.CommandArgument.ToString());
     string value = GridView_View_Notification.Rows[index].Cells[1].Text;/*Error Line*/
     int abc = Convert.ToInt32(value);
     lb_Notification.Text = abc.ToString();
        
    }
Posted
Updated 28-Dec-16 20:32pm
v2
Comments
Thomas Nielsen - getCore 29-Dec-16 6:06am    
do you get the index variable filled correctly?
Your error means that either that row number doesn't exist on page one or the 2nd column doesn't. Your row command executes after your page load event, did you remember to load the grid again on the right page in your postback load event too?
Muhammd Aamir 29-Dec-16 6:47am    
Yes Thomas i got the right index
Muhammd Aamir 29-Dec-16 6:48am    
I done it. Now, the problem is in textchanged event the textchanded event does't fire anymore
Why? Can you show that code?
Muhammd Aamir 29-Dec-16 23:52pm    
if (e.commandName.tostring()=="your command name")
{
//do something
}

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900