Click here to Skip to main content
15,919,245 members

Comments by tahirgr8_2000 (Top 5 by date)

tahirgr8_2000 7-Jul-14 0:57am View    
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "window.close()", true);
Server.Transfer("DisplayMessage.aspx");

Check this . I have used this code for first close my current window and then try to go to new page . But Window not close , only page open with in same tab.
tahirgr8_2000 7-Jul-14 0:48am View    
Dear sergey,
I want that when i click sumbit button, the current page1.aspx will close and it will redirect to another new page2.aspx.
tahirgr8_2000 25-Jun-14 8:04am View    
First Page for storing value into table action 01


using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Specialized;
using System.Data.SqlClient;
using System.Linq;



public partial class _1a: System.Web.UI.Page
{ private string Status1A;
private string Status1B;
private string Status1C;
private string Status1D;
private string action1a;

private string StrInsert;
private SqlCommand Sql;
private SqlConnection hookUp;
protected void Page_Load(object sender, EventArgs e)
{
Status1A += Checkbox1.Checked == true ? Checkbox1.Value : null;
Status1B += Checkbox2.Checked == true ? Checkbox2.Value : null;
Status1C += Checkbox3.Checked == true ? Checkbox3.Value : null;
Status1D += Checkbox4.Checked == true ? Checkbox4.Value : null;

action1a += Status1A + Status1B + Status1C + Status1D + TextBox1;
}

protected void Button1_Click(object sender, EventArgs e)
{
hookUp = new SqlConnection("Server=localhost\\Sqlexpress; Database=ActionTakenDB;" + "Integrated Security=True");
StrInsert = "insert into Action1A values (@Action1a)";
Sql = new SqlCommand(StrInsert, hookUp);
Sql.Parameters.Add(new SqlParameter("@Action1a", SqlDbType.VarChar, 100));
Sql.Parameters["@Action1a"].Value = action1a;
hookUp.Open();

Sql.ExecuteNonQuery();

hookUp.Close();
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "Close", "window.close()", true);
}
}


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="1a.aspx.cs" Inherits="_1a" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Checkbox1" type="checkbox" value="Pump seal replaced," runat="server" /> Pump seal replaced<br />
<input id="Checkbox2" type="checkbox" value="Bearing changed," runat="server" /> Bearing changed<br />
<input id="Checkbox3" type="checkbox" value="wiring proper," runat="server" /> wiring proper<br />
<input id="Checkbox4" type="checkbox" value="fuse replace" runat="server" /> fuse replace<br />
<input id="TextBox1" type="text" runat="server" /> Others <br />

<asp:Button ID="Button1" runat="server" Text="Submit" onclick="Button1_Click" />
</div>

</form>
</body>
</html>





Now Second Page for storing value into Table ACtion02 continue in next comment

tahirgr8_2000 25-Jun-14 6:28am View    
Dear Kasushal and Debarata, you are right about my queries. How i will create table in visual studio by code or manually as we do in sql studio.
tahirgr8_2000 25-Jun-14 4:28am View    
I dont want to get the text input value. I want to get window user login name from domain
usernameID += txtUserName.Text;