Click here to Skip to main content
15,914,013 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Add multiple rows to a gridview Pin
manchu_200920-May-09 22:02
manchu_200920-May-09 22:02 
GeneralRe: Add multiple rows to a gridview Pin
manchu_200920-May-09 22:36
manchu_200920-May-09 22:36 
GeneralRe: Add multiple rows to a gridview Pin
padmanabhan N20-May-09 22:40
padmanabhan N20-May-09 22:40 
Questionwindow.open Pin
kanadoss20-May-09 20:03
kanadoss20-May-09 20:03 
AnswerRe: window.open Pin
Ramesh Swaminathan20-May-09 20:12
Ramesh Swaminathan20-May-09 20:12 
GeneralRe: window.open Pin
kanadoss20-May-09 20:46
kanadoss20-May-09 20:46 
GeneralRe: window.open Pin
wenweiping21-May-09 15:45
wenweiping21-May-09 15:45 
QuestionHow to get the datakeys of GridView in second page? Pin
meeram39520-May-09 19:22
meeram39520-May-09 19:22 
I have a griview in my page with paging. The gridview contains the first column as UserId which is a Datakey column. The issue is when I go to secondpage, it is giving the error saying that " Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" .

On the second page, the index getting is 10. What am I doing wrong here? How should i get the datakey value? Following is the code I'm using.

int Userid = 0;
int index = 0; 
 foreach (GridViewRow gvr in SearchGrid.Rows)
 {
   CheckBox cb = (CheckBox)gvr.FindControl("chkbox1");
   if (cb.Checked)
  {
    index = gvr.DataItemIndex;
    Userid = Convert.ToInt32(SearchGrid.DataKeys[index].Value);
  }
}

I am getting error on the last line when clicked on 2nd page. Can anybody provide any solution? 
Thanks in advance.


Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.

AnswerRe: How to get the datakeys of GridView in second page? Pin
padmanabhan N20-May-09 19:40
padmanabhan N20-May-09 19:40 
GeneralRe: How to get the datakeys of GridView in second page? Pin
meeram39520-May-09 20:30
meeram39520-May-09 20:30 
GeneralRe: How to get the datakeys of GridView in second page? Pin
padmanabhan N20-May-09 21:00
padmanabhan N20-May-09 21:00 
GeneralRe: How to get the datakeys of GridView in second page? Pin
meeram39520-May-09 23:13
meeram39520-May-09 23:13 
AnswerRe: How to get the datakeys of GridView in second page? Pin
Ramesh Swaminathan20-May-09 19:53
Ramesh Swaminathan20-May-09 19:53 
QuestionRange values in Crystal Report Pin
Girish48120-May-09 19:21
Girish48120-May-09 19:21 
AnswerRe: Range values in Crystal Report Pin
Ramesh Swaminathan20-May-09 19:36
Ramesh Swaminathan20-May-09 19:36 
GeneralRe: Range values in Crystal Report Pin
Girish48120-May-09 20:01
Girish48120-May-09 20:01 
QuestionMessagebox and alerts Pin
jainiraj20-May-09 18:44
jainiraj20-May-09 18:44 
AnswerRe: Messagebox and alerts [modified] Pin
deepthy.p.m20-May-09 18:50
deepthy.p.m20-May-09 18:50 
AnswerRe: Messagebox and alerts Pin
padmanabhan N20-May-09 18:52
padmanabhan N20-May-09 18:52 
AnswerRe: Messagebox and alerts Pin
Ramesh Swaminathan20-May-09 19:10
Ramesh Swaminathan20-May-09 19:10 
Questionvalidate Dropdownlist inside gridview using javascript Pin
deepthy.p.m20-May-09 18:42
deepthy.p.m20-May-09 18:42 
AnswerRe: validate Dropdownlist inside gridview using javascript Pin
padmanabhan N20-May-09 19:03
padmanabhan N20-May-09 19:03 
GeneralRe: validate Dropdownlist inside gridview using javascript Pin
deepthy.p.m20-May-09 19:08
deepthy.p.m20-May-09 19:08 
GeneralRe: validate Dropdownlist inside gridview using javascript Pin
sidbaruah20-May-09 21:54
sidbaruah20-May-09 21:54 
AnswerRe: validate Dropdownlist inside gridview using javascript Pin
harish mehra4-Jun-09 23:55
harish mehra4-Jun-09 23:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.