tags:

views:

89

answers:

3

how do I fetch a user ID that is associated with the email address entered by the user in the text box?

+5  A: 

if I understand you correctly you have to query the Database to get the ID Where the email column equals the one entered in the text box. take a look on this link from msdn , and set the Select command to :

SELECT userID from [your table name] Where emailAddressColumn = @emailAddressColumn

and in the SqlDatasource Selecting event write :

e.command.parameters["@emailAddressColumn "] = TextBox_Email.Text;
M.H
yep..thats what I want
Serenity
A: 

I suppose you have a database with and ID and email?

Then grab the email in your postback, use it to query the database where you have a table with a column ID and a column email and have it return the ID.

Marcel de Kleine
A: 

Here we can find the username

 class Test
{
    static void Main(string[] args)
    {
        string s = "[email protected]";
        int indexof_attherate = s.IndexOf('@');
        string textUpto_attherate = s.Substring(0, indexof_attherate);
        Console.WriteLine(textUpto_attherate);
        Console.Read();
    }
}

Why don't you use the Database

programmer4programming