如何清除查询字符串 [英] how to clear Query string

查看:81
本文介绍了如何清除查询字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,在我的房地产网站上有一个小模子,这里有一个精选物业页面,其中显示了所有列出的物业,并在每个物业下方显示了详细信息按钮.我在同一浏览器的新选项卡中打开了详细信息页面,然后单击每个属性的按钮.但是当关闭所有选项卡并刷新特色属性页面时,我打开的最后一个属性会在新选项卡中自动打开.

m使用以下代码.

数据列表中的onitemcommand

Sir m having a dought in my real estate website there is Featured property page in which all the listed property is displayed and view detail button below every property. I opened the detail page in new tab in the same browser on button click for every property.But when close all the tab and refresh the featured property page last property which i opened is opening automatically in new tab.

m using the folowing code.

onitemcommand in datalist

protected void Datalist1_ItemCommand(object sender, DataListCommandEventArgs e)
    {
        switch (e.CommandName)
        {
           string strJS = ("<script type='text/javascript'>window.open('ViewDetail.aspx?Property_ID=" + e.CommandArgument.ToString() + "','_blank');</script>");
                Page.ClientScript.RegisterStartupScript(this.GetType(), "strJSAlert", strJS);                
        }
}




按钮设计




Button design

<asp:Button class="btndetail" ID="btndetails" CommandName="viewdetail" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"Property_ID") %>' runat="server"  Text="ViewDetails" />




这就是m在我的详细信息页面中绑定数据的方式




this is how m binding data in my detail page

protected void Page_Load(object sender, EventArgs e)
   {
       if (!IsPostBack)
       {
           Session["Property_ID"] = Request.QueryString["Property_ID"].ToString();
           Displaydetails(Request.QueryString["Property_ID"].ToString());
       }
   }

   private void Displaydetails(string Property_ID)
   {
       int PropertyID = Convert.ToInt16(Property_ID);
       try
       {
           SqlConnection con = new SqlConnection(str);
           string strQ = ("select s.Property_ID,s.Property_For,s.Property_Type,s.Property_Name,C.City_Name,L.Locality_Name,s.Price,s.Bedroom,s.Area,s.ImageName,s.ImagePath,s.Address,s.Pincode,s.Key_Features,s.Date_Posted From tbl_Post_Property as s inner join tbl_City as C on C.City_Id=s.City_id inner join tbl_Locality as L on L.Locality_Id=s.Locality_Id where Property_ID=" + PropertyID + "");
           con.Open();
           SqlDataAdapter da = new SqlDataAdapter(strQ, con);
           DataTable dt = new DataTable();
           da.Fill(dt);
           PropDetail.DataSource = dt;
           PropDetail.DataBind();


       }
       catch (Exception ex)
       {

       }


   }

推荐答案

那不是您所能控制的.用户的配置将定义是否为此操作打开新标签页或新窗口.
That isn''t something that is under your control. The user''s configuration will define whether a new tab or a new window gets opened for this action.


这篇关于如何清除查询字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆