Click here to Skip to main content
14,773,285 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:

I have one text box and one search button. When the user enters an email address into the text box then the related data should display in a grid view . i take a one example suppose we enter the text box is [DELETED] when we click Button then we need to find the email id related data such as name,address,phone no and other details and enter the grid view etc

how is this possible


Arvind kumar singh

The OP added:

data is stored in database table ,table is saleslead ,salelead Field is
EmailId,name,age ,City ,address;when user enter the mail ID in text box and click the button then the values is show in Gridview

[edit]Never post your email address in any forum, unless you really like spam! If anyone replies to you, you will receive an email to let you know - OriginalGriff[/edit]
Updated 12-Apr-11 1:47am
Johnny J. 12-Apr-11 6:38am
What related data? Where and how is that stored? You need to specify your question more - and preferably post the code you have so far...
Arvind_singh 12-Apr-11 6:45am
data is stored in database table ,table is saleslead ,salelead Field is
EmailId,name,age ,City ,address;when user enter the mail ID in text box and click the button then the values is show in Gridview
Tarun.K.S 12-Apr-11 6:39am
Need more info Arvind. Show us the code.
OriginalGriff 12-Apr-11 6:47am
Even with your version 3 of this question, there is not enough info.
We need to know where you store the info, how the email relates to it and so on.
What have you tried?
Johnny J. 12-Apr-11 6:47am
OK, you have amended your question, but the information is still not enough. FROM WHERE do you want to fetch the extra data? Are you talking about data stored in a datatable, outlook accounts or what??? The data will have to come from somewhere, and if we don't know where, we can't help you. If you don't know either, then the answer is: It can't be done!

The first question which will be asked when you post your own question is: What have YOU tried? If you post your code, it makes it easier for the folks to guide you.

If you are looking at "Enter text and then search" kind of things then what is stopping you from writing your logic inside the button click event?

Just handle the button click event, capture the data entered into the textbox and query your database to display the result.

A friendly reminder: We do not give code. We help you correct it. Hope this helped. :)
Arvind_singh 12-Apr-11 6:52am
Thanks Sir
Use an SQL SELECT statement in the usual way:
using (SqlConnection con = new SqlConnection(connectionString))
    using (SqlCommand com = new SqlCommand("SELECT * FROM myTable WHERE email=@EM", con))
        com.Parameters.AddWithValue("@EM", myTextBoxWithEmailIn.Text);
        // Insert to your gridView as normal.
Arvind_singh 12-Apr-11 6:52am
Thanks Sir
Arvind_singh 12-Apr-11 7:03am
Thanks Sir ,Code is Successfully running

//First You Need To send your Email address to the database to match with the Same Email id from the DataBase

//Code Behind Code

Cmd = new SqlCommand("Sp_verifyEmailAddress", Con);
Cmd.CommandType = CommandType.StoredProcedure;
dt= new SqlDataAdapter();
DataSet ds= new DataSet()

//create Procedure into the DataBase Like That 

create procedure Sp_verifyEmailAddress
@EmailId varchar(100)


declare Id int
set id= 0

declare Result int 

select Id= PersonsId from table where EmailId = @EmailId

set Result=0
select Result

select * from table where PersonsId=id

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900