Last post Jan 25, 2017 08:41 PM by dlchase
Jan 24, 2017 01:03 PM|ThameedASP.NEt|LINK
I have this bellow gridview
For example If use click Add Row on 5th Row then i want to show new row create automatically where user enter his data
how to do so to add rows
Jan 24, 2017 02:29 PM|jimmy69|LINK
if i well understand your description and the image you give, you'd like when user click on row 5 for example add a new row BUT not in the end of the gridview ...?
you'd like that the new row was added after the row you click ?
if yes perhpas this code can help you :
DataRow dr = dt.DefaultView.Table.NewRow();
dr ..... => creating new row
// insert row
dt.Rows.InsertAt(dr, THE ROW);
on click on button keept the id (THE ROW) build your new row , add this new row to your data table and bind again your grid view ...
Normally it will be work..
Jan 24, 2017 02:31 PM|ThameedASP.NEt|LINK
any live tutorial so that it will help me
Jan 24, 2017 02:35 PM|jimmy69|LINK
but could you confirm what do you need ?
normally the add button is add outside the gridview ... we need more information if you want some help
Jan 24, 2017 02:47 PM|ThameedASP.NEt|LINK
on page load i bind gridview from tables
like serial wise data as shown
now user want to add some data in between that row in gridview
For example: If user want to add one new row he will click add row on 4th row the new row should be generate.. there user will enter data and after that i upload that gridview in bulk to my table
Jan 24, 2017 04:25 PM|jimmy69|LINK
nothing found and not really time to code a full sample ...but for me on click on the button you need :
- opens a pop up page with some controls (textbox, save button , cancel button) and keept the id when the button was click
- click on the save button (pop up) save your new record with the id saved + 1
now you have probably the duplicate ID for to avoid that you need for example delete all your record and insert all ...
have a nice day
Jan 25, 2017 06:14 AM|navneetmitawa|LINK
Check this post for perform this type of action in gridview...
Jan 25, 2017 08:41 PM|dlchase|LINK
Have you considered converting it to a ListView? You could then use the SelectedItemTemplate to be the insert template that you desire. ListView is so much more flexible due to its template design.
If that is not possible then maybe you could do something in code on GridView SelectedIndexChanged event that would show a hidden row of input fields.
Just my thoughts.