Click here to Skip to main content
15,920,053 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerBAD USER! Pin
leckey14-Aug-07 4:59
leckey14-Aug-07 4:59 
Questionsvg mapping using asp.net??? Pin
mmm!@#13-Aug-07 17:16
mmm!@#13-Aug-07 17:16 
Questionhow to access the checkbox control in nested gridview Pin
SharonRao13-Aug-07 15:03
SharonRao13-Aug-07 15:03 
QuestionImages Pin
seemamltn13-Aug-07 14:17
seemamltn13-Aug-07 14:17 
QuestionUnable to cast object of type 'System.DBNull' to type 'System.Byte[]'. Pin
Nadia Monalisa13-Aug-07 11:31
Nadia Monalisa13-Aug-07 11:31 
AnswerRe: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'. Pin
Michael Sync13-Aug-07 15:40
Michael Sync13-Aug-07 15:40 
GeneralRe: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'. Pin
Nadia Monalisa13-Aug-07 17:09
Nadia Monalisa13-Aug-07 17:09 
GeneralRe: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'. Pin
Michael Sync13-Aug-07 17:44
Michael Sync13-Aug-07 17:44 
I don't think that it's your responsibility to prevent this error. Let's say one simple one.

Example 1 ~

You are the control developer. So, you create one control that has one property. The type of this property is "int". I'm your client and I'm using your control in my problem. I wanna set one value to the property of your control. then, I wrote like yourcontrol.IntProperty = "Mike";. so, i will be getting the error since I'm setting wrong string data type to int type. In that situration, this is my responsibility for checking the datatype. (your client in your case.)

Do you get what I mean?

Example 2 ~

But let's say there is one function called "SetDataSource(DataTable)" in your control.

You wrote like that in that function of control ~


public void SetDataSource(DataTable dt){<br />
  foreach(DataRow dr in dt.Rows){<br />
    string str = (string)dr[0];  <br />
  }<br />
}


When the user is passing the datatable that contains NULL values, your function will throw the error.
For that case, you have the responsibility for checking whether this value is null or not before casting the type.

So, you decide your case is like example 1 or 2. I think your case is like example 1. so, i don't think you need to do something about it.



Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)

If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. Smile | :)

GeneralRe: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'. Pin
Nadia Monalisa13-Aug-07 23:51
Nadia Monalisa13-Aug-07 23:51 
GeneralRe: Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'. Pin
Member 766318817-Aug-11 8:00
Member 766318817-Aug-11 8:00 
QuestionDatagrid help Pin
Ridge Howison13-Aug-07 10:48
Ridge Howison13-Aug-07 10:48 
AnswerRe: Datagrid help Pin
Fred_Smith13-Aug-07 12:39
Fred_Smith13-Aug-07 12:39 
QuestionAccess Asp.net control from client side javascript Pin
Ali Rafiee13-Aug-07 9:28
Ali Rafiee13-Aug-07 9:28 
QuestionRadioButtonList and Hover Balloon Pin
janetb9913-Aug-07 9:22
janetb9913-Aug-07 9:22 
AnswerRe: RadioButtonList and Hover Balloon Pin
N a v a n e e t h13-Aug-07 21:05
N a v a n e e t h13-Aug-07 21:05 
QuestionRecursion Pin
seemamltn13-Aug-07 8:11
seemamltn13-Aug-07 8:11 
AnswerRe: Recursion Pin
Christian Graus13-Aug-07 8:21
protectorChristian Graus13-Aug-07 8:21 
QuestionCreating a pager application help needed Pin
ski_freak13-Aug-07 7:55
ski_freak13-Aug-07 7:55 
AnswerRe: Creating a pager application help needed Pin
ToddHileHoffer13-Aug-07 8:09
ToddHileHoffer13-Aug-07 8:09 
QuestionPersist Gridview Data Pin
kjosh13-Aug-07 6:33
kjosh13-Aug-07 6:33 
AnswerRe: Persist Gridview Data Pin
ToddHileHoffer13-Aug-07 7:55
ToddHileHoffer13-Aug-07 7:55 
GeneralRe: Persist Gridview Data Pin
kjosh14-Aug-07 3:36
kjosh14-Aug-07 3:36 
QuestionGridview with validation Pin
kjosh13-Aug-07 5:15
kjosh13-Aug-07 5:15 
QuestionAccess parent page controls from Iframe [modified] Pin
rana7813-Aug-07 4:42
rana7813-Aug-07 4:42 
AnswerRe: Access parent page controls from Iframe Pin
Michael Sync13-Aug-07 5:49
Michael Sync13-Aug-07 5:49 

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.