You want to check for isdbnull while using datarow from a datatable/dataset this is how you use it..
C# CODE:
Assuming orow is the datarow you are working with ...
if (!Convert.IsDBNull(orow [5]))
{
// Do some thing
}
else
{
//Do some thing else...
}
Thanks,
Suman
Showing posts with label asp. Show all posts
Showing posts with label asp. Show all posts
Tuesday, September 21, 2010
Friday, April 9, 2010
Force the users to download rather than opening
For known content types like PDF, doc, mp3 etc..... when you have a download link it just opens it in the browser if the browser knows how to open..
If you want to force the user to download rather than being opened / played in web browser do the following with asp.net
Create a link using a link button and on button click do the following
string myFilename="../docs/abc.doc";
Response.AppendHeader( "content-disposition", "attachment; filename=" + myFilename );
The 2 lines above would force the browser to show the download box .
Hope this Helps.
Bobby
If you want to force the user to download rather than being opened / played in web browser do the following with asp.net
Create a link using a link button and on button click do the following
string myFilename="../docs/abc.doc";
Response.AppendHeader( "content-disposition", "attachment; filename=" + myFilename );
The 2 lines above would force the browser to show the download box .
Hope this Helps.
Bobby
Labels:
.NET,
ajax,
AppendHeader,
asp,
asp.net,
attachment,
Browser,
C#,
C#.NET,
Content Download,
content Type,
Content-disposition,
finename,
HTML,
Response,
Web apps
Wednesday, March 10, 2010
Keyboard quits working in visual studio 2005
For Some reason Unknown (Or known only to microsoft) some times the keyboard would quit working on VS 2005.
Re installation might help some times and some times it wont.
Looks like when you click on Design to switch to Design mode you will lose the Key board .
Here is a link for the Fix that i found which fixes it
http://petesbloggerama.blogspot.com/2006/07/internet-explorer-7-beta-3-and-loss-of.html
Thanks,
Bobby
Re installation might help some times and some times it wont.
Looks like when you click on Design to switch to Design mode you will lose the Key board .
Here is a link for the Fix that i found which fixes it
http://petesbloggerama.blogspot.com/2006/07/internet-explorer-7-beta-3-and-loss-of.html
Thanks,
Bobby
Labels:
asp,
asp.net,
C#,
C#.NET,
functionality,
key board doesnt work,
keyboard,
microsoft,
visual studio 2005,
vs 2005
Monday, February 22, 2010
Inject javascript in Head Section using asp.net
Even though it doesn't matter where the script is in the form or in the head section, you want to have it in the HEAD section of the HTML.
When you use Page.RegisterClientScriptBlock it injects the script in the body.
To inject in the HEAD section do the following...
When you use Page.RegisterClientScriptBlock it injects the script in the body.
To inject in the HEAD section do the following...
HtmlGenericControl myScriptCode = new HtmlGenericControl("script"); myScriptCode.Attributes.Add("type", "text/javascript"); myScriptCode.InnerHtml = "alert('Alert generated by Script in Head Section of HTML');"; this.Page.Header.Controls.Add(myScriptCode);that should do it.check it by clicking view source and you should see the Script in HEAD section If you want to refer to a js file as a external file use the SRC attribute
string jssrc="../abc.js"; HtmlGenericControl myScriptCode = new HtmlGenericControl("script"); myScriptCode.Attributes.Add("type", "text/javascript"); myScriptCode.Attributes.Add("src",jssrc); this.Page.Header.Controls.Add(myScriptCode);
Labels:
.NET,
asp,
asp.net,
C#,
C#.NET,
dotnet,
FORM,
HEAD,
HTML,
inject,
javascript,
javascript from code behind,
javascript in head section,
programming,
SCRIPT,
software
Subscribe to:
Comments (Atom)