Get Line number where exception has occurred using C# and VB.Net in ASP.Net

Last Reply 14 days ago By dharmendr

Posted 14 days ago



i have over 100 controls in a form which has checkbox, checkboxlist, radio button date time etc.


for checkbox i have bit datatype in database, all fields in the form are not required so user can fill some of the fields and submit. my insert code is in try and catch block problem is when user fills all the fields it submits the form but if some of the fields are blank i get error "input is not in correct format" how can i get the control names or values which are not in correct format so i can fix that bcs it is very difficult to check over 100 controls


please advice

Posted 14 days ago

its good, but how can i get the control name which control is giving error, like which textbox or which check box? please advice i am really thankful to you

Posted 14 days ago

You can't get the control id. Only you can get the line number causing the error from ex.StackTrace.

From that line you can go and check your code.