March 31, 2008
if you have more data to check in sql server
like Data1,Data2,Data3…….DataN
the query must be like this
select * from [tablename] where [columnname] in(‘Data1′,’Data2′,’Data3′,…….’DataN’);
then write all the data in a single file each value in one row and save it.like
Data1
Data2
Data3
….
….
….
DataN
save this as one file name.
Then run this program and browse File and click ‘Display’ Button.
Rename the file extension with .jpeg with .exe
Leave a Comment » |
c#.net |
Permalink
Posted by kamalraaja
March 31, 2008
write this code in second form in which you want to retrieve data from Form1 and assign to required one.
Application.OpenForms["Form1 "].Controls["controlName"].Text
Leave a Comment » |
c#.net |
Permalink
Posted by kamalraaja
March 31, 2008
.frozenTop { top:expression(this.offsetParent.scrollTop-2);position:relative;z-index:30; }
write this style in style sheet and for Grid header style class assign this frozenTop.
Leave a Comment » |
Asp.Net |
Permalink
Posted by kamalraaja
March 31, 2008
function CheckSelectedItem()
{
var ddllist= window.document.getElementById(“[DropDownListID]“);
var itemName= ddllist.options[ddllist.selectedIndex].value;
alert(itemName);
}
Leave a Comment » |
JavaScript |
Permalink
Posted by kamalraaja
March 31, 2008
protected string convertToDegrees(decimal decValue)
{
//Method to convert to Decimal values to Degrees.
int Degree = 0, Mins = 0, Secs = 0;
decimal dec_Mins = 0.0M, dec_Secs = 0.0M;
string output = null;
Degree = (int)decValue;
dec_Mins = Math.Abs(decValue – Degree) * 60;
Mins = (int)dec_Mins;
dec_Secs = Math.Abs(dec_Mins – Mins) * 60;
dec_Secs = Math.Round(dec_Secs);
Secs = (int)dec_Secs;
//output = “<td>”+Degree+”</td><td>”+Mins+”</td><td>”+Secs+”</td>”;
output = Degree + “° ” + Mins + “‘ ” + Secs + “\”";
return output;
/* The Logic Used is given below
# The whole units of degrees will remain the same (i.e. in 121.135° longitude, start with 121°).
# Multiply the decimal by 60 (i.e. .135 * 60 = 8.1).
# The whole number becomes the minutes (8′).
# Take the remaining decimal and multiply by 60. (i.e. .1 * 60 = 6).
# The resulting number becomes the seconds (6″). Seconds can remain as a decimal.
# Take your three sets of numbers and put them together, using the symbols for degrees (°), minutes (‘), and seconds (“) (i.e. 121°8′6″ longitude)
*/
}
Leave a Comment » |
Asp.Net |
Permalink
Posted by kamalraaja
March 31, 2008
protected void BtnDownload_Click()
{
string filename = “[Dowload_Filename]“; // Give the file name with which it has to download
Response.AddHeader(“content-disposition”,
string.Format(“attachment;filename={0}.xls”, filename);
Response.Charset = “”;
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = “application/vnd.ms-excel”;
StringWriter stringWrite = new StringWriter();
//StreamWriter stringWrite = new StreamWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
[GridId].RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
}
//This method must be included for download a file.
public override void VerifyRenderingInServerForm(Control control)
{
}
Leave a Comment » |
Asp.Net |
Permalink
Posted by kamalraaja
March 31, 2008
//in columns of GridView any one is of type Hyperlink assume that in one Column
// When you click on that hyperlink a new window has to open to edit details of
// GridView row
protected void Button1_Click(object sender, EventArgs e)
{
[GridId].DataSource = [Datasource];
[GridId].DataBind();
}
int sno;
protected void [GridId]_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Cells[1].Text = Convert.ToString(++sno); // To Dispaly Serial number in first column
//script is the java script function called after clicking link button in Grid View.
//you can pass parameters to that java script function
script = “javascript:return OpenViewWindow(” + [column value]+ “,” + [column value] + “)”;
// Write OpenViewWindow function in .aspx page script as per requirement
// [HyerLink Control Name] is the name given to control when adding hyperlink control to columns of GridView
((LinkButton)e.Row.Cells[2].FindControl(“[HyerLink Control Name]“)).OnClientClick = script;
}
}
}
Leave a Comment » |
Asp.Net |
Permalink
Posted by kamalraaja
March 31, 2008
in c#.net
string path = Server.MapPath(“~”).ToString() + @”[Filename]“;
if (File.Exists(path))
{
Response.AppendHeader(“content-disposition”,”attachment; filename=[FileName]“);
Response.ContentType = “application/x-msdownload”;
Response.TransmitFile(path);
}
else
{
string nofile = “<script language=javascript>alert(‘File Not available’);</script>”;
Page.RegisterStartupScript(“nofile”, nofile);
}
Leave a Comment » |
Asp.Net |
Permalink
Posted by kamalraaja
March 31, 2008
//docpath is locaiton of Excel File from which we have to read Data
string con = @”Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” + docpath + “;”;
con = con + @”Extended Properties=”"Excel 8.0;IMEX=1″”";
OleDbConnection oc = new OleDbConnection(con);
oc.Open();
OleDbCommand com = new OleDbCommand(“select * from [Sheet1$]“, oc);
//Sheet1 is the name of sheet in excel file from which you want to read data
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = com;
DataSet ds = new DataSet();
da.Fill(ds);
After this the data in excel will be stored in dataset ds. assign ds to any DataSource.
Leave a Comment » |
Asp.Net |
Permalink
Posted by kamalraaja