Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
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 project....so what should be the coding for that???
Posted 23-Aug-12 7:31am
Comments
Wes Aday at 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 at 23-Aug-12 14:12pm
   
i don't understand question at all!
Rate this: bad
good
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);
  Permalink  
Rate this: bad
good
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
    <div>
        <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>
        
 
        <asp:label id="Label2" runat="server" text="Email" xmlns:asp="#unknown"></asp:label>
        <asp:textbox id="TextBox2" runat="server" xmlns:asp="#unknown"></asp:textbox>
        
 
        
 
        <asp:button id="Button1" runat="server" onclick="Button1_Click" text="Edit" xmlns:asp="#unknown" />
    </div>
 
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;
            dtblClient.Dispose();
        }
    }
    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", "sandip@test.com"});
            
        return dtbl;
    }
 
Hope this helps.
cheers
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 304
1 Sergey Alexandrovich Kryukov 255
2 Maciej Los 250
3 Shweta N Mishra 216
4 PIEBALDconsult 174
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,665


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 23 Aug 2012
Copyright © CodeProject, 1999-2014
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