Click here to Skip to main content
13,042,630 members (80,298 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I m working on One MLM Software project as Jr.developer now in this application one administrator is there now i have working with editing the web form for that Admin..... now suppose if i want to edit data of admin like address mobile no email ID Phone NO........and one text box is there for admon name that will never change so whenever admin want to update his/her data that name should be bind on that textbox each and every time cliclk on that text box means simply i want to bind that name from database.......i m strongly working with 3 Tier application so there should be DAL file BLL FIle and MY what should be the coding for that???
Posted 23-Aug-12 6:31am
Wes Aday 23-Aug-12 12:37pm
So you want someone to write up all this code for you based on this vague description? Or did you have something more in line with a specific question?
ridoy 23-Aug-12 14:12pm
i don't understand question at all!
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Your DAL would contain a method to return the text based on what ids are needed and you'd do myTextBox.Text = DAL.GetText(id);
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Your question is not very specic. Though, what I have understood, you need to edit a page where you will edit all the details address, mobile, email etc but never the name.

I am not clear what you mean to say binding data to name in every click.
But what I guess is you want the name to be shown in the text box but, user cannot change edit the textbox.

If this is the thing you want, my friend you have thought too far.

Simply populate the data into all textbox, dropdown etc in pageload event.
After the populate code, just disable name textbox control.

Here is the code

aspx page
    <asp:label id="Label1" runat="server" text="Admin Name" xmlns:asp="#unknown"></asp:label>
    <asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown"></asp:textbox>
    <br />
    <asp:label id="Label2" runat="server" text="Email" xmlns:asp="#unknown"></asp:label>
    <asp:textbox id="TextBox2" runat="server" xmlns:asp="#unknown"></asp:textbox>
    <br />
    <br />
    <asp:button id="Button1" runat="server" onclick="Button1_Click" text="Edit" xmlns:asp="#unknown" />

code behind
    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
            //populate from database
            DataTable dtblClient = doPopulate();
            foreach (DataRow dr in dtblClient.Rows)
                TextBox1.Text = dr["name"].ToString();
                TextBox2.Text = dr["email"].ToString();
            //make the name textbox disable
            TextBox1.Enabled = false;
    private DataTable doPopulate()
        //call databse to get the data as reader or datatable
        //here in the e.g, I create a custom datatable
        DataTable dtbl = new DataTable();
        dtbl.Columns.Add(new DataColumn("id", Type.GetType("System.Int32")));
        dtbl.Columns.Add(new DataColumn("name", Type.GetType("System.String")));
        dtbl.Columns.Add(new DataColumn("email", Type.GetType("System.String")));
        dtbl.Rows.Add(new object[]{1, "Sandip", ""});
        return dtbl;

Hope this helps.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 23 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100