Monday 12 August 2013

DATA SEARCHING FROM GOOGLE.COM BY ANIL KUMAR

DATA SEARCHING FROM GOOGLE.COM

<form id="form1" runat="server" method="post">
 <div>
        <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"
            ontextchanged="TextBox1_TextChanged"></asp:TextBox>
   

    <asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>
    <asp:Button ID="Button2" runat="server" Text="Button" />
    </div>
   
    </form>
...................................................................................................................
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;


  protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                string text = string.Empty;
                StringBuilder txtaddress = new StringBuilder();
                txtaddress.Append("https://www.google.com/search?q=");
                if (searchtxt.Text != string.Empty)
                {
                    text = searchtxt.Text.Replace(' ', '+');
                    txtaddress.Append(text + ' ' + '+');
                }
                string url = txtaddress.ToString();
                Response.Redirect(url, false);
            }
            catch (Exception ex)
            {
                Response.Redirect(ex.ToString());
            }
        }

No comments:

Post a Comment