Redirecting page will open perticular webpage based on passing parameter?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mandlaanilbabu
    New Member
    • Sep 2012
    • 11

    #16
    yes,

    I want to chnge CUSTID=2 based on that id corresponding siteurl data value(EX:http://bytes.com) this will open directli open in browser

    Comment

    • mandlaanilbabu
      New Member
      • Sep 2012
      • 11

      #17
      Hi,I am getting result but opening new tab window browser,
      Can any one help me I want to same page,after that I want to change query string value that corresponding value will open in browser plz help me any one

      Comment

      • mandlaanilbabu
        New Member
        • Sep 2012
        • 11

        #18
        Default.aspx
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

        <html xmlns="http://www.w3.org/1999/xhtml">
        <head runat="server">
        <title></title>
        </head>
        <body>
        <form id="form1" runat="server">
        <div>
        <asp:GridView ID="Gvurl" runat="server" AutoGenerateSel ectButton="True " AutoGenerateCol umns="false"
        onselectedindex changing="GvDep t_SelectedIndex Changing" Width="227px">
        </asp:GridView>
        </div>
        </form>
        </body>
        </html>
        .CS
        protected void Page_Load(objec t sender, EventArgs e)
        {
        SqlConnection con = new SqlConnection( @"Data Source=<>;Initi al Catalog=product db;Persist Security Info=True;User ID=<>;Password= <>");

        SqlDataAdapter da = new SqlDataAdapter( "select * from redirecturl", con);

        DataSet ds = new DataSet();
        da.Fill(ds, "redirectur l");
        Gvurl.DataSourc e = ds.Tables["redirectur l"];
        Gvurl.DataBind( );
        Gvurl.DataKeyNa mes = new string[] { "customerid " };
        }
        protected void GvDept_Selected IndexChanging(o bject sender, GridViewSelectE ventArgs e)
        {
        Gvurl.SelectedI ndex = e.NewSelectedIn dex;

        string Dno = Gvurl.SelectedV alue.ToString() ;

        Response.Redire ct("~/QueryStringPara ms2.Aspx?TagId= "+Dno);

        }
        QueryStringPara ms2.Aspx
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

        <html xmlns="http://www.w3.org/1999/xhtml">
        <head runat="server">
        <title></title>
        <script>

        </script>
        </head>
        <body>
        <form id="form1" runat="server">
        <div>
        <asp:GridView ID="GvRed" runat="server"
        EmptyDataText=" There Are No Employees In Selected Department"
        AutoGenerateCol umns="false" Width="99px">
        <%--<Columns>
        <asp:TemplateFi eld HeaderText="Red irect URL">
        <ItemTemplate >
        <a href='<%#Eval(" coupounurl") %>'><%#Eval("co upounurl")%></a>
        </ItemTemplate>
        </asp:TemplateFie ld>
        </Columns>--%>
        </asp:GridView>
        <br />
        </div>
        </form>
        </body>
        </html>
        .CS
        public partial class QueryStringPara ms2 : System.Web.UI.P age
        {

        String URL = "";
        protected void Page_Load(objec t sender, EventArgs e)
        {
        string Dno = Request.QuerySt ring["TagId"];

        SqlConnection con = new SqlConnection( @"Data Source=<>;Initi al Catalog=product db;Persist Security Info=True;User ID=<>;Password= <>");

        SqlCommand cmd = new SqlCommand("sel ect coupounurl from redirecturl where customerid=" + Dno, con);

        con.Open();

        SqlDataReader dr = cmd.ExecuteRead er();
        GvRed.DataSourc e = dr;
        GvRed.DataBind( );
        dr.Close();

        object drReader = cmd.ExecuteScal ar();
        if (drReader != null)
        {
        URL = drReader.ToStri ng();
        }

        con.Close();
        if (!String.IsNull OrEmpty(URL))
        {

        Response.Write( "<script language='javas cript'>window.o pen('" + URL + "','_newtab ');</script>");

        }



        }

        Comment

        • mandlaanilbabu
          New Member
          • Sep 2012
          • 11

          #19
          I want to open in same page display passing query string corresponding value open in browser(EX:www.google.com:TagId=1)
          After that i am chnging TagId=2 it will open corresponding value(Ex:www.bytes.com) and so on..

          Comment

          Working...