Thursday, July 1, 2010

Save Image in Data Base & Retrieve it on GridView using ASP.Net 2.0

Save Image in Data Base & Retrieve it on GridView using ASP.Net 2.0::

http://docs.google.com/document/pub?id=1IANkP1TeWgE_3pzf1BfrBnJZarqaIXDVJuCHnzkvSqU

Friday, June 18, 2010

Menu Control binded with Site Map

Code for Site Map (Add web1.sitemap before start in your project.)

STr=?xml version="1.0" encoding="utf-8" ?
siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"

siteMapNode url="" title="" description=""
siteMapNode url="" title="Itinerary" description="hi"
siteMapNode url="main.aspx" title="Search" description="Search Itinerary" /
/siteMapNode
siteMapNode url="" title="Password" description="About" >
siteMapNode url="ChangePassword.aspx" title="Change Password" description="Change Password" />

siteMapNode>-->
siteMapNode url="" title="Setup" description="Setup" >
siteMapNode url="Settings.aspx" title="Setup and Config" description="Setup and Config" />
/siteMapNode>

siteMapNode url="" title="About" description="About" >
siteMapNode url="about.aspx" title="Product" description="Product" />
siteMapNode url="http://www.amadeus.in" title="Amadeus" description="Amadeus" />
/siteMapNode>
/siteMapNode>
/siteMap>

****in above code Please put Evry row in <> Brackets, then it works

Then Code for code behind in Menu page

private void CreateMenuControl()
{
Menu1.DataSource = GetSiteMApDataSource();
Menu1.DataBind();
}

private SiteMapDataSource GetSiteMApDataSource()
{
XmlSiteMapProvider xmlsiteMAp = new XmlSiteMapProvider();
System.Collections.Specialized.NameValueCollection myCollection =
new System.Collections.Specialized.NameValueCollection(1);

if (Session["UserRole"].ToString().ToUpper() == "ADMIN")
{
myCollection.Add("siteMapFile", "web.sitemap");
}
else if (Session["UserRole"].ToString().ToUpper() == "USER")
{
myCollection.Add("siteMapFile", "Web2.sitemap");
}

xmlsiteMAp.Initialize("provider", myCollection);
xmlsiteMAp.BuildSiteMap();
SiteMapDataSource siteMap = new SiteMapDataSource();
siteMap.ShowStartingNode = false;
myCollection = null;
if (Session["UserRole"].ToString().ToUpper() == "ADMIN")
{
siteMap.SiteMapProvider = "DefaultSiteMapProvider";
}
else if (Session["UserRole"].ToString().ToUpper() == "USER")
{
siteMap.SiteMapProvider = "MySiteMapProvider";
}

return siteMap;
}

Download server file on Client Side using ASP.net 2.0

private void DownloadFileMSI()
{
string fname = Server.MapPath("PNRExtractor") + "\\PNRExtractor.msi";
Response.ContentType = "application/exe";
Response.AddHeader("content-disposition", "attachment; filename=PNRExtractor.msi");

//System.IO.FileStream sourceFile = new System.IO.FileStream(@"" + fname, System.IO.FileMode.OpenOrCreate);
System.IO.FileStream sourceFile = new System.IO.FileStream(@"" + fname, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.None);
long FileSize;
FileSize = sourceFile.Length;
byte[] getContent = new byte[(int)FileSize];
sourceFile.Read(getContent, 0, (int)sourceFile.Length);
sourceFile.Close();
Response.BinaryWrite(getContent);
}

Thursday, May 13, 2010

Crystal report- Handling multiple values in parameter seperated by(,)

Please follow the link :
1. https://docs.google.com/document/edit?id=1IlBv-F5N0ByQwzyouGqwUiFlQ9DXc5Zi5imAzGAKZcM&hl=en

2. If want to assign Subreport parameter through code then Add Parameter in Main Report ,Create Same type Parameter in Subreport & link it with mail report using report link.

Now Pass the value through code to main report's parameter.

Monday, April 26, 2010

Getting Value of Control inherited by Master Page through Javascript

ddlServiceFee is a serverside drop down list control.
This function enable/ disable other control on selection of values.

https://docs.google.com/document/edit?id=1fcWwbcHUOarvyEmTuZRKQlval6zY3gZMQeSmpmOGkgs#