Get the question number from the end of the calling control's ID


/ Published in: C#
Save to your folder(s)

Useful when you have multiple fields on a page that call the same method (ie via OnSelectedIndexChanged), since you can't pass a param as part of the call


Copy this code and paste it in your HTML
  1. int QuestionNumber = Convert.ToInt16(rbList.ID.ToString().Substring(rbList.ID.ToString().Length -1, 1)); //get the question number from the end of the control's ID.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.