How can I set session variables with JavaScript ?
#How can I set session variables with JavaScript
#Assigning Session variable from Javascript
#How do i set a session variable using javascript?
Information about ASP.NET, C#, VB.NET,JQuery, AJAX, SQL Server, Java script,.NET tips and tricks, LINQ, OOPS Concept, DotNet Interview Questions
var newwindow;
function openwindow(url)
{
newwindow=window.open(url,'name','height=800,width=600');
if (window.focus) {newwindow.focus()}
}
PROCEDURE "GET_ALL_AREA"
(
ITEMS_CURSOR OUT SYS_REFCURSOR
)
is
BEGIN
OPEN ITEMS_CURSOR FOR SELECT AREAID,AREANAME,AREAPINCODE FROM AREA;
END;
DataSet ds = new DataSet();
OracleCommand command = new OracleCommand();
command.CommandType = CommandType.StoredProcedure;
command.CommandText = “Get_All_Area”;
command.Connection = conn.Get_Connection();
command.Parameters.Add("ITEMS_CURSOR", OracleType.Cursor ).Direction = ParameterDirection.Output;
OracleDataAdapter adpt = new OracleDataAdapter(Command);
adpt.Fill(ds, str_table);
Close_Connection();
public string Connection_String
{
get
{
return ConfigurationSettings.AppSettings["dbConnectionString"];
}
}
//Function For Open New Connection
public OracleConnection Get_Connection()
{
try
{
OracleConn = new OracleConnection(Connection_String);
OracleConn.Open();
}
catch (Exception ex)
{
throw ex;
}
return OracleConn;
}
//Close Connection
public void Close_Connection()
{
try
{
OracleConn.Close();
}
catch(Exception ex)
{
throw new Exception(ex.Message, ex);
}
}
public static string PropCase(string strText)
{
return new CultureInfo("en").TextInfo.ToTitleCase(strText.ToLower());
}
HTML FILE :
<script language="javascript">
function CallPrint( strid )
{
var prtContent = document.getElementById( strid );
var WinPrint = window.open('', '', 'left=0,top=0,width=900,height=600,toolbar=1,scrollbars=1,status=0');
WinPrint.document.write( prtContent.innerHTML );
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
WinPrint.close();
prtContent.innerHTML=strOldOne;
}
script>
<div id="print_Grid">
This is Print
This is Print
This is Print
This is Print
This is Print
div>
Code FILE :
protected void Page_Load(object sender, EventArgs e)
{
btnPrint.Attributes.Add("onclick", "javascript:CallPrint('print_Grid')");
}
How To Use This Code?
1. Copy JavaScript into your HTML Page
2. Make a Div Tag Which data you want to print into that div tag
3. Add Print Button and call JavaScript Function
SELECT C.EmployeeId, C.FirstName,C.LastName,
(SELECT COUNT(*) FROM Employee C2
P_Id | LastName | FirstName | Address | City |
---|---|---|---|---|
1 | Rajesh | Ahmedabad | Timoteivn 10 | Sandnes |
2 | Svendson | Tove | Borgvn 23 | Sandnes |
3 | Pettersen | Kari | Storgt 20 | Stavanger |
O_Id | OrderNo | P_Id |
---|---|---|
1 | 77895 | 3 |
2 | 44678 | 3 |
3 | 22456 | 1 |
4 | 24562 | 1 |
5 | 34764 | 15 |
SELECT column_name(s) FROM table_name1 INNER JOIN table_name2 ON table_name1.column_name=table_name2.column_name |
P_Id | LastName | FirstName | Address | City |
---|---|---|---|---|
1 | Rajesh | Ahmedabad | Timoteivn 10 | Sandnes |
2 | Svendson | Tove | Borgvn 23 | Sandnes |
3 | Pettersen | Kari | Storgt 20 | Stavanger |
O_Id | OrderNo | P_Id |
---|---|---|
1 | 77895 | 3 |
2 | 44678 | 3 |
3 | 22456 | 1 |
4 | 24562 | 1 |
5 | 34764 | 15 |
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo FROM Persons INNER JOIN Orders ON Persons.P_Id=Orders.P_Id ORDER BY Persons.LastName |
LastName | FirstName | OrderNo |
---|---|---|
Rajesh | Ahmedabad | 22456 |
Rajesh | Ahmedabad | 24562 |
Pettersen | Kari | 77895 |
Pettersen | Kari | 44678 |
SELECT column_name(s) FROM table_name1 LEFT JOIN table_name2 ON table_name1.column_name=table_name2.column_name |
SELECT column_name(s) FROM table_name1 RIGHT JOIN table_name2 ON table_name1.column_name=table_name2.column_name |
SELECT column_name(s) FROM table_name1 FULL JOIN table_name2 ON table_name1.column_name=table_name2.column_name