How to add new to webgrid in mvc4RDRukasana Dange12yAsked May 5, 2014, 1:27 AM EDT5 answersShareLinkedInXCopy linkSavehow to add new row dynamically in webgrid or in table in mvc4 on change of last column value using jquery. Please reply..its urgent.. Thanks
How to add new to webgrid in mvc4RDRukasana Dange12yAsked May 5, 2014, 1:27 AM EDT5 answersShareLinkedInXCopy linkSavehow to add new row dynamically in webgrid or in table in mvc4 on change of last column value using jquery. Please reply..its urgent.. Thanks
Jaganathan BantheswaranRank #170 · 14.1K reputation12y agoPosted May 5, 2014, 1:36 AM EDT0HI,You have to manually add the table row when user clicks on the Add button. WebGrid: @grid.GetHtml(columns: grid.Columns(grid.Column("Title", style: "title"), grid.Column("ISBN", style: "isbn"), grid.Column("Author", style: "author"), grid.Column("Category", style: "category"), grid.Column("Price", style: "price", format: @@item.Price.ToString("c"))))Add0
RDRukasana Dange5 reputation12y agoPosted May 5, 2014, 2:19 AM EDT0i don't want on add button click..i want on onchange event of last column value which adds new row to table using jquery.Thanks0
Jaganathan BantheswaranRank #170 · 14.1K reputation12y agoPosted May 5, 2014, 4:38 AM EDT0Well, Just change the event something like this,$('.your-last-column').on('change', function () { //code here });0
RDRukasana Dange5 reputation12y agoPosted May 7, 2014, 8:39 PM EDT0I have tried but add row not working.here is my code..@grid.GetHtml(columns: grid.Columns(grid.Column("Account Code"),grid.Column("Doc No"),grid.Column("Doc Date"),grid.Column("Currency Id"),grid.Column("Currency Code"),grid.Column("Price", format: @@item.Price.ToString("c"))))$(function () {$('#price').on('change', function () {$('table').append('' +'' +'' +'' +'' +'curr_code\' id=\'curr_code\' />' +'' +'Save');});0Jignesh TrivediRank #16 · 50.3K reputation12y agoPosted May 7, 2014, 9:17 PM EDT0hi,Please refer http://www.dotnet-tricks.com/Tutorial/mvc/E2S9150113-Enhancing-WebGrid-with-Insert-Update-and-Delete-Operations.htmlhttp://www.mikesdotnetting.com/Article/223/Adding-a-New-Row-In-The-Razor-WebGridhope this will help you.0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jignesh TrivediRank #16 · 50.3K reputation12y agoPosted May 7, 2014, 9:17 PM EDT0hi,Please refer http://www.dotnet-tricks.com/Tutorial/mvc/E2S9150113-Enhancing-WebGrid-with-Insert-Update-and-Delete-Operations.htmlhttp://www.mikesdotnetting.com/Article/223/Adding-a-New-Row-In-The-Razor-WebGridhope this will help you.0
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted May 5, 2014, 1:36 AM EDT
You have to manually add the table row when user clicks on the Add button.
WebGrid:
Rukasana Dange5 reputationPosted May 5, 2014, 2:19 AM EDT
Thanks
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted May 5, 2014, 4:38 AM EDT
$('.your-last-column').on('change', function () { //code here });
Rukasana Dange5 reputationPosted May 7, 2014, 8:39 PM EDT
@grid.GetHtml(columns: grid.Columns(grid.Column("Account Code"),
grid.Column("Doc No"),
grid.Column("Doc Date"),
grid.Column("Currency Id"),
grid.Column("Currency Code"),
grid.Column("Price", format: @
$(function () {
$('#price').on('change', function () {
$('table').append('
'
'
'
'
'
'
'
});
Jignesh TrivediRank #16 · 50.3K reputationPosted May 7, 2014, 9:17 PM EDT
hi,
Please refer
http://www.dotnet-tricks.com/Tutorial/mvc/E2S9150113-Enhancing-WebGrid-with-Insert-Update-and-Delete-Operations.html
http://www.mikesdotnetting.com/Article/223/Adding-a-New-Row-In-The-Razor-WebGrid
hope this will help you.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts