![]() |
trying to bind datagrid column text to radiobuttonlist
Hi,
im trying to use a datagrid to display a survey which is stored in a db. Theres 3 columns - column 1 to store the question number,column 2 to store the actual question and column 3 to store the different answer options.I wanted to bind the diff answeroptions in column3 to a radiobuttonlist and this is when the probs started i keep getting this error: Quote:
Code:
Sub BindDataGrid()any suggestions gratefully received |
You need that stack trace. It tells you which object reference was supposedly null.
The problem is that you're calling a method somewhere on something you expect isn't null, but it is. object.methodcall() but object is null, so somewhere, something isn't getting creating. Could be anywhere; thus, the stack trace. For example: rbl = DirectCast(e.Item.FindControl("rblist"), RadioButtonList) You never check that it actually found that control. Then you use rbl as if it had. |
Hi Nikki,
thanks for your reply-im very grateful for your info,however i have no idea how to figure out from that stack trace which object is null..none of it makes any sense to me,im still relatively new to asp.net:( this is what it says,anyone know what on earth this means :o Quote:
|
Okay, forgive me I usually use C# (and get better error messages with a line number and the code that errored out, which is set in the config file somewhere), but I believe this is wrong.
Dim Conn As New OdbcConnection("ConnStr") You're supposed to pass that a connection, not a string. Dim Conn As New OdbcConnection(ConnStr) Note: no quotes. So, no connection, which would make this line throw a nullpointerexception: Conn.Open() or maybe this one... Dim Cmd As New OdbcCommand("SELECT anstext FROM Ans_Options", Conn) No conn, no object. No object, nullpointerexception... |
| All times are GMT +1. The time now is 01:11 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.