Click here to Skip to main content
16,008,175 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: more than one Report display in .net Pin
Sylvester george26-Feb-07 19:59
Sylvester george26-Feb-07 19:59 
GeneralRe: more than one Report display in .net Pin
Kissy1626-Feb-07 20:23
Kissy1626-Feb-07 20:23 
GeneralRe: more than one Report display in .net Pin
Sylvester george26-Feb-07 20:42
Sylvester george26-Feb-07 20:42 
GeneralRe: more than one Report display in .net Pin
Kissy1626-Feb-07 22:19
Kissy1626-Feb-07 22:19 
GeneralRe: more than one Report display in .net Pin
Sylvester george26-Feb-07 22:24
Sylvester george26-Feb-07 22:24 
GeneralRe: more than one Report display in .net Pin
Kissy1626-Feb-07 22:37
Kissy1626-Feb-07 22:37 
GeneralRe: more than one Report display in .net Pin
Sylvester george26-Feb-07 22:41
Sylvester george26-Feb-07 22:41 
Questioncannot add a blank row to a bound datagrid with checkbox control [modified] Pin
BORN...again!26-Feb-07 17:51
BORN...again!26-Feb-07 17:51 
Hello,

I think I am posting this question again but I'm quite frustrated as I haven't found any way around.

I have a databound datagrid in which New/Blank rows are added to this datagrid on a button click event. This button is outside the datagrid and not in the footer. The datagrid populates well and I can do the edit/update to the already created records. I recently had to add a new checkbox field to my data table. This chekcbox field is to be included in this datagrid. The chkbox works fine for previously created records but as soon as I hit the 'Add New Row' button I get the following error :

Exception Details: System.InvalidCastException: Conversion from type 'DBNull' to type 'Boolean' is not valid.

Source Error:
asp:checkbox id="cbcurrentdriver" runat="server" autopostback="true" enabled ="false" checked='<%# DataBinder.Eval(Container.DataItem,"currentdriver") %>' />


My code for adding a new/blank row (on button click event) is as below:
RefreshGrid()
Dim ds as DataSet = DataGrid.datasource
Dim blank as DataRow = ds.tables(0).NewRow()

ds.tables(0).Rows.insertAt(blank, ds.tables(0).Rows.Count)
DataGrid.EditItemIndex = ds.tables(0).Rows.Count-1
DataGrid.DataBind()


and my checkbox template column is as below:

asp:templatecolumn headertext="Current Driver?">
itemTemplate>
asp:checkbox id="cbcurrentdriver" runat="server" autopostback="true" enabled ="false" checked='<%# DataBinder.Eval(Container.DataItem,"currentdriver") %>' />


I really am clueless on this one. everything seems fine. Nulls are allowed on this field in my datatable.Please help!

Thanks.




-- modified at 23:58 Monday 26th February, 2007

Aartee.
...HE is watching Us All!

AnswerRe: cannot add a blank row to a bound datagrid with checkbox control Pin
Tuwing.Sabado26-Feb-07 18:29
Tuwing.Sabado26-Feb-07 18:29 
GeneralRe: cannot add a blank row to a bound datagrid with checkbox control Pin
BORN...again!26-Feb-07 18:45
BORN...again!26-Feb-07 18:45 
GeneralRe: cannot add a blank row to a bound datagrid with checkbox control [modified] Pin
Tuwing.Sabado26-Feb-07 19:32
Tuwing.Sabado26-Feb-07 19:32 
GeneralRe: cannot add a blank row to a bound datagrid with checkbox control Pin
BORN...again!27-Feb-07 12:15
BORN...again!27-Feb-07 12:15 
GeneralRe: cannot add a blank row to a bound datagrid with checkbox control Pin
BORN...again!27-Feb-07 14:46
BORN...again!27-Feb-07 14:46 
QuestionAdjusting height of Multipage control [modified] Pin
Vsree26-Feb-07 17:50
Vsree26-Feb-07 17:50 
QuestionHow to do the user can add field in the screen page? Pin
sdev26-Feb-07 17:33
sdev26-Feb-07 17:33 
AnswerRe: How to do the user can add field in the screen page? Pin
Sandeep Akhare26-Feb-07 19:13
Sandeep Akhare26-Feb-07 19:13 
GeneralRe: How to do the user can add field in the screen page? Pin
sdev26-Feb-07 19:25
sdev26-Feb-07 19:25 
GeneralRe: How to do the user can add field in the screen page? Pin
Sandeep Akhare26-Feb-07 19:32
Sandeep Akhare26-Feb-07 19:32 
GeneralRe: How to do the user can add field in the screen page? Pin
sdev26-Feb-07 20:04
sdev26-Feb-07 20:04 
Questionjavascript and xml Pin
Member 309559326-Feb-07 17:10
Member 309559326-Feb-07 17:10 
AnswerRe: javascript and xml Pin
Sandeep Akhare26-Feb-07 19:44
Sandeep Akhare26-Feb-07 19:44 
QuestionCan't access database Pin
Eyungwah26-Feb-07 14:26
Eyungwah26-Feb-07 14:26 
QuestionPassing Color Parameters Pin
Expert Coming26-Feb-07 13:11
Expert Coming26-Feb-07 13:11 
AnswerRe: Passing Color Parameters Pin
Guffa26-Feb-07 13:38
Guffa26-Feb-07 13:38 
QuestionList installed framework on server and list installed browsers on Windows... Pin
Kasic Slobodan26-Feb-07 12:11
Kasic Slobodan26-Feb-07 12:11 

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.