|
1.) How to call javascript from c# code under button_click without using Button1.Attributes.Is there any method?
string strsql = "< script language="javascript" > lovechild=window.open('Default.aspx','', 'width:150px, resizable=no,scroolbar=no'); "; this.Response.Write(strsql); |
InProc mode, which stores session state in memory on the Web server. This is the default. StateServer mode, which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm. SQLServer mode stores session state in a SQL Server database. This ensures that session state is reserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm. Custom mode, which enables you to specify a custom storage provider. Off mode, which disables session state.
3.) In which database sql server session will be stored?
Session state is stored in the tempdb database of SQL Server.
4) How to call javascript function from webform1 to webform2?
Using Submit Form Method : You can submit the form in Webform1.aspx to webform2.aspx. In that case, you can retrieve all the WebForm1's form element from webform2. What we will do in the below example is to add another form ( not a server side one) which will have two HTML controls; the first is an submit control the second is a hidden field which will have the value of TextBox1 web server control to be posted to webform2 Ex: now the HTML code of webform1 will look like below
<form id="Form1" method="post" runat="server">
</form>
<asp:textbox id="TextBox1" runat="server" >< /asp:textbox>
<form action="WebForm2.aspx" method="post" name="SubmittedForm">
</form>
<input id="Submit1" onclick="CopyTextToHiddenField()" value="submit"/>
<input name="Hidden1" />
Of course you realized the we handled the onclick event of the submit button which will call a javascript function to copy the value of TextBox1 into the hidden field (Hidden1) in order to post it to webform2.
Also you so in the second form tag the action attribute in which we specified to which page the second form (SubmittedForm) will be posted.
Add the below javascript code inside the <head> tag of WebForm1.
< script language="javascript" >
function CopyTextToHiddenField()
{
var textbox1Value = document.getElementById("<%=TextBox1.ClientID%>").value;
document.forms[1].document.getElementById("Hidden1").value = textbox1Value;
}
< /script>
Now you retrieve the value of "Hidden1" hidden field in webform 2 using the below code Response.Write(Request.Form["Hidden1"]);
5) Webserver controls and Html controls differences?
U can get more difference here Difference Between Web Server Control and HTML Controls