Skip to content

[topic about C# Language]

Kishan shekhada

Asked Jul 8, 2015, 4:30 AM EDT4 answers
Share
LinkedInX
TextBox kishan = (TextBox)FindControl(name_id);  is this code is right or not....??
 
 
how to find name from database...??

4 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Pranay Rana
    +1
    you can try like this
     
     if(FindControl(name_id) is TextBox)
        TextBox kishan = FindControl(name_id) as TextBox;
     
    how find name from database to broad question you can make use of google there are code to read data from database 
    +1
  • Pranay Rana
    +1
    so name_id is need to be replace by the id of control you want to search
     
     if control is is txtCustomer
    than you should try "txtCustomer" instead of name_id and also use previous provided answer 
    +1
  • 0
    TextBox kishan = FindControl(name_id)as TextBox;
     
    "name_id" is generate error that 'name_id' does not exist in current context. 
    0
  • 0
    C#
         // PlaceHolder objPlace = new PlaceHolder();
            Table objT = (Table)placeHolder.FindControl("tblPerson");
    
            foreach (TableRow objTR in objT.Rows)
            {
                foreach (TableCell Cells in objTR.Cells)
                {
                    TextBox txt = (TextBox)Cells.FindControl("textbox1");
                    TextBox kishan = FindControl(name_id)as TextBox;
    
                    string query = "select nid from mstInvestor";
    
            //Find Textbox Id From Second Column And Find Name By Removing "td_"
                //Database Query(Select) --Find nid
                //Find Value Of Textbox(Rs)
                //Query Insert
                }
            }
    
            //Get ID of All TextBox Generate Dynamically In Usercontrol
            //For(i=0;i<txtbox; i++)
            //{Store In Database As Debit}
        }
    0