我想在按钮单击中使用response.redirect打开新选项卡或新页面.即时通讯使用查询字符串传递一些值.所以如何在新选项卡中打开页面.
protected void btnSave_Click(object sender, EventArgs e)
{
...//some code to insert records
Response.Redirect("NewQuote.aspx?val=" + this.txtQuotationNo.Text);//displaying gridview in other page to print what needed
}
Run Code Online (Sandbox Code Playgroud) 我想减少标题和段落之间的垂直间距.
<td style="width:427px;">
<h2 style="color:#156CA4">Quotation</h2>
<p style="color:#00A651">abc Technologies Pvt Ltd</p>
</td>
Run Code Online (Sandbox Code Playgroud) 在sql server数据库中插入记录时。每次插入 2 条记录时,我认为事件会触发两次。如何停止在 ado.net 中插入两次记录。
protected void btnSubmit_Click(object sender, EventArgs e)
{
try
{
CompanyName = txtCompany.Text.Trim();
InsertData();
}
catch (Exception)
{
throw;
}
}
private void InsertData()
{
if (Page.IsPostBack)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["kernelCS"].ConnectionString);
SqlCommand cmd = new SqlCommand(@"INSERT INTO [tbl_Leads]([CompanyName])VALUES(@CompanyName)", con);
cmd.Parameters.AddWithValue("@CompanyName", txtCompany.Text.ToString());
con.Open();
cmd.ExecuteNonQuery();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
...
}
}
Run Code Online (Sandbox Code Playgroud) 如何在C#中修剪十进制值的给定字符串中的小数部分.即将获得20472.060 o/p - 20472
decimal totalamountWithTaxes = pri + result1 + result2 ;
string totalAmountPlusTaxes = totalamountWithTaxes.ToString();
Run Code Online (Sandbox Code Playgroud) 我有一个按钮事件。在活动结束时,我将重定向到另一个页面。但无法在新标签页中打开。
给出编译错误 -
常量中的换行符
//Response.Redirect("DeliveryChallanPrint1.aspx?val=" +this.txtPoNo.Text);
Response.Write("<script>");
Response.Write("window.open('DeliveryChallanPrint1.aspx?val="+this.txtPoNo.Text','_blank')");//error - newline in constant
Response.Write("</script>");
Run Code Online (Sandbox Code Playgroud) 如何将日期时间字段转换为1st Feb 2011C#格式的字符串?doj是datetimesql server中的字段.
string DateOfJoin = dt.Rows[0]["DOJ"].ToString();//2011-02-01 00:00:00.000
Run Code Online (Sandbox Code Playgroud) 我想将字符串转换为int.我有像这样的字符串值"45,454,566.00".虽然类型转换抛出错误
输入字符串的格式不正确
int GrandTotalInWords = Int32.Parse(grandtotal);//error
grandTotalInWords.InnerHtml = ConvertNumbertoWords(GrandTotalInWords);
Run Code Online (Sandbox Code Playgroud)