#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    17
    Rep Power
    0

    Gridview with first row as textboxes


    Hi guys,

    I have been googling a lot on this subject but didn't find anything that really helped me. I have a gridview and bound some data to it. For now it's nothing fancy. The thing is I want to add in the first row (under the header) some textboxes for the purpose of adding new rows.

    Has anyone done this or can point me to the right direction ?

    Edit: I found some sort of solution. I'm sure there's some real trick but this is going work for me I think.

    I added in the code behind:

    Code:
          _dsBind = new DataSet();
          _dsBind = _ObjBal.GetAll();
    
          DataTable _dt = new DataTable();
          DataRow _dr = _dt.Rows.Add();
          _dt.Merge(_dsBind.Tables[0]);
    
          myGridView.DataSource = _dt;
          myGridView.DataBind();
    It adds a row without textboxes. I then use jquery to put a textbox when clicking in the cell and css to make it look like it's a textbox at first and when the user click outside the cell.

    That being said if somebody has a real solution I'll be happy to try it.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2014
    Posts
    3
    Rep Power
    0

    Web Design Pune- Libricon


    Originally Posted by onTheDev
    Hi guys,

    I have been googling a lot on this subject but didn't find anything that really helped me. I have a gridview and bound some data to it. For now it's nothing fancy. The thing is I want to add in the first row (under the header) some textboxes for the purpose of adding new rows.

    Has anyone done this or can point me to the right direction ?

    Edit: I found some sort of solution. I'm sure there's some real trick but this is going work for me I think.

    I added in the code behind:

    Code:
          _dsBind = new DataSet();
          _dsBind = _ObjBal.GetAll();
    
          DataTable _dt = new DataTable();
          DataRow _dr = _dt.Rows.Add();
          _dt.Merge(_dsBind.Tables[0]);
    
          myGridView.DataSource = _dt;
          myGridView.DataBind();
    It adds a row without textboxes. I then use jquery to put a textbox when clicking in the cell and css to make it look like it's a textbox at first and when the user click outside the cell.

    That being said if somebody has a real solution I'll be happy to try it.
    Hi I learnt this problem but exactly we don't get right answer.

IMN logo majestic logo threadwatch logo seochat tools logo