Delete row from Radgrid and refresh page











up vote
0
down vote

favorite












I have looked all over SO for an answer, but my case seems to be a bit different than the ones posted. I have a Radgrid (Shopping Cart) on my form along with other components (order summary, for example). I want to be able to delete a row from the radgrid and refresh order summary.



What I have tried so far:




  1. Used Radgrid's ItemCommand with a button to delete row. This deletes
    the row just fine but does not refresh order summary.

  2. Used a button's 'onclick' property to delete row and refresh order summary. This does not actually save the updated radgrid (with
    the row removed).

  3. Implemented Step 1 with a LinkButton. Same issue.

  4. Used a button's onclick property to then call ItemCommand and delete the row. This deletes the row but does not refresh summary.


I am fairly new to VB, and what I think is happening is when row is deleted using ItemCommand, it's updating the radgrid, but the form is not submitting. Shouldn't button_onclick handle that?



What am I doing wrong? Any help/suggestion would be highly appreciated!



Edit:



Here is my .aspx code:



<asp:LinkButton ID="lnkRemove" OnClick="lnkRemove_Click" OnCommand="CommandEventHandler" CommandName="Delete" runat="server" Text="Remove" />


And here's my codebehind:



        Protected Sub lnkRemove_Click(ByVal sender As Object, ByVal e As EventArgs)
RefreshGrid() 'Refreshes shopping cart grid
OrderSummary.Refresh() 'Not working
End Sub

Protected Sub CommandEventHandler(ByVal sender As Object, ByVal e As CommandEventArgs)
Dim e1 As GridCommandEventArgs = TryCast(e, GridCommandEventArgs)
If Not e1 Is Nothing Then
grdMain_ItemCommand(sender, e1)
End If
End Sub

Protected Sub grdMain_ItemCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs) Handles grdMain.ItemCommand
Dim table As DataTable = CType(ViewState("dtCart"), DataTable)
If e.CommandName = "Delete" Then
Dim index As Integer = e.Item.ItemIndex
table.Rows(index).Delete()
'more code to remove item(s) from radgrid
End Sub









share|improve this question
























  • I resolved the issue by adding another button 'Update Order' on the form that then posts the page back to the server and order summary gets refreshed. I was making this way more complicated than it should've been.
    – monalisa
    Nov 12 at 15:04















up vote
0
down vote

favorite












I have looked all over SO for an answer, but my case seems to be a bit different than the ones posted. I have a Radgrid (Shopping Cart) on my form along with other components (order summary, for example). I want to be able to delete a row from the radgrid and refresh order summary.



What I have tried so far:




  1. Used Radgrid's ItemCommand with a button to delete row. This deletes
    the row just fine but does not refresh order summary.

  2. Used a button's 'onclick' property to delete row and refresh order summary. This does not actually save the updated radgrid (with
    the row removed).

  3. Implemented Step 1 with a LinkButton. Same issue.

  4. Used a button's onclick property to then call ItemCommand and delete the row. This deletes the row but does not refresh summary.


I am fairly new to VB, and what I think is happening is when row is deleted using ItemCommand, it's updating the radgrid, but the form is not submitting. Shouldn't button_onclick handle that?



What am I doing wrong? Any help/suggestion would be highly appreciated!



Edit:



Here is my .aspx code:



<asp:LinkButton ID="lnkRemove" OnClick="lnkRemove_Click" OnCommand="CommandEventHandler" CommandName="Delete" runat="server" Text="Remove" />


And here's my codebehind:



        Protected Sub lnkRemove_Click(ByVal sender As Object, ByVal e As EventArgs)
RefreshGrid() 'Refreshes shopping cart grid
OrderSummary.Refresh() 'Not working
End Sub

Protected Sub CommandEventHandler(ByVal sender As Object, ByVal e As CommandEventArgs)
Dim e1 As GridCommandEventArgs = TryCast(e, GridCommandEventArgs)
If Not e1 Is Nothing Then
grdMain_ItemCommand(sender, e1)
End If
End Sub

Protected Sub grdMain_ItemCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs) Handles grdMain.ItemCommand
Dim table As DataTable = CType(ViewState("dtCart"), DataTable)
If e.CommandName = "Delete" Then
Dim index As Integer = e.Item.ItemIndex
table.Rows(index).Delete()
'more code to remove item(s) from radgrid
End Sub









share|improve this question
























  • I resolved the issue by adding another button 'Update Order' on the form that then posts the page back to the server and order summary gets refreshed. I was making this way more complicated than it should've been.
    – monalisa
    Nov 12 at 15:04













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have looked all over SO for an answer, but my case seems to be a bit different than the ones posted. I have a Radgrid (Shopping Cart) on my form along with other components (order summary, for example). I want to be able to delete a row from the radgrid and refresh order summary.



What I have tried so far:




  1. Used Radgrid's ItemCommand with a button to delete row. This deletes
    the row just fine but does not refresh order summary.

  2. Used a button's 'onclick' property to delete row and refresh order summary. This does not actually save the updated radgrid (with
    the row removed).

  3. Implemented Step 1 with a LinkButton. Same issue.

  4. Used a button's onclick property to then call ItemCommand and delete the row. This deletes the row but does not refresh summary.


I am fairly new to VB, and what I think is happening is when row is deleted using ItemCommand, it's updating the radgrid, but the form is not submitting. Shouldn't button_onclick handle that?



What am I doing wrong? Any help/suggestion would be highly appreciated!



Edit:



Here is my .aspx code:



<asp:LinkButton ID="lnkRemove" OnClick="lnkRemove_Click" OnCommand="CommandEventHandler" CommandName="Delete" runat="server" Text="Remove" />


And here's my codebehind:



        Protected Sub lnkRemove_Click(ByVal sender As Object, ByVal e As EventArgs)
RefreshGrid() 'Refreshes shopping cart grid
OrderSummary.Refresh() 'Not working
End Sub

Protected Sub CommandEventHandler(ByVal sender As Object, ByVal e As CommandEventArgs)
Dim e1 As GridCommandEventArgs = TryCast(e, GridCommandEventArgs)
If Not e1 Is Nothing Then
grdMain_ItemCommand(sender, e1)
End If
End Sub

Protected Sub grdMain_ItemCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs) Handles grdMain.ItemCommand
Dim table As DataTable = CType(ViewState("dtCart"), DataTable)
If e.CommandName = "Delete" Then
Dim index As Integer = e.Item.ItemIndex
table.Rows(index).Delete()
'more code to remove item(s) from radgrid
End Sub









share|improve this question















I have looked all over SO for an answer, but my case seems to be a bit different than the ones posted. I have a Radgrid (Shopping Cart) on my form along with other components (order summary, for example). I want to be able to delete a row from the radgrid and refresh order summary.



What I have tried so far:




  1. Used Radgrid's ItemCommand with a button to delete row. This deletes
    the row just fine but does not refresh order summary.

  2. Used a button's 'onclick' property to delete row and refresh order summary. This does not actually save the updated radgrid (with
    the row removed).

  3. Implemented Step 1 with a LinkButton. Same issue.

  4. Used a button's onclick property to then call ItemCommand and delete the row. This deletes the row but does not refresh summary.


I am fairly new to VB, and what I think is happening is when row is deleted using ItemCommand, it's updating the radgrid, but the form is not submitting. Shouldn't button_onclick handle that?



What am I doing wrong? Any help/suggestion would be highly appreciated!



Edit:



Here is my .aspx code:



<asp:LinkButton ID="lnkRemove" OnClick="lnkRemove_Click" OnCommand="CommandEventHandler" CommandName="Delete" runat="server" Text="Remove" />


And here's my codebehind:



        Protected Sub lnkRemove_Click(ByVal sender As Object, ByVal e As EventArgs)
RefreshGrid() 'Refreshes shopping cart grid
OrderSummary.Refresh() 'Not working
End Sub

Protected Sub CommandEventHandler(ByVal sender As Object, ByVal e As CommandEventArgs)
Dim e1 As GridCommandEventArgs = TryCast(e, GridCommandEventArgs)
If Not e1 Is Nothing Then
grdMain_ItemCommand(sender, e1)
End If
End Sub

Protected Sub grdMain_ItemCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs) Handles grdMain.ItemCommand
Dim table As DataTable = CType(ViewState("dtCart"), DataTable)
If e.CommandName = "Delete" Then
Dim index As Integer = e.Item.ItemIndex
table.Rows(index).Delete()
'more code to remove item(s) from radgrid
End Sub






javascript asp.net vb.net postback radgrid






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 20:45

























asked Nov 9 at 21:59









monalisa

63




63












  • I resolved the issue by adding another button 'Update Order' on the form that then posts the page back to the server and order summary gets refreshed. I was making this way more complicated than it should've been.
    – monalisa
    Nov 12 at 15:04


















  • I resolved the issue by adding another button 'Update Order' on the form that then posts the page back to the server and order summary gets refreshed. I was making this way more complicated than it should've been.
    – monalisa
    Nov 12 at 15:04
















I resolved the issue by adding another button 'Update Order' on the form that then posts the page back to the server and order summary gets refreshed. I was making this way more complicated than it should've been.
– monalisa
Nov 12 at 15:04




I resolved the issue by adding another button 'Update Order' on the form that then posts the page back to the server and order summary gets refreshed. I was making this way more complicated than it should've been.
– monalisa
Nov 12 at 15:04












1 Answer
1






active

oldest

votes

















up vote
0
down vote













Can you please provide some code so maybe I can help for you. Because If you write down that have you done it's not helping maybe you did good just you missed a part from the code






share|improve this answer





















  • Thanks Romeo, please see my edit for the code.
    – monalisa
    Nov 11 at 20:45











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233785%2fdelete-row-from-radgrid-and-refresh-page%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Can you please provide some code so maybe I can help for you. Because If you write down that have you done it's not helping maybe you did good just you missed a part from the code






share|improve this answer





















  • Thanks Romeo, please see my edit for the code.
    – monalisa
    Nov 11 at 20:45















up vote
0
down vote













Can you please provide some code so maybe I can help for you. Because If you write down that have you done it's not helping maybe you did good just you missed a part from the code






share|improve this answer





















  • Thanks Romeo, please see my edit for the code.
    – monalisa
    Nov 11 at 20:45













up vote
0
down vote










up vote
0
down vote









Can you please provide some code so maybe I can help for you. Because If you write down that have you done it's not helping maybe you did good just you missed a part from the code






share|improve this answer












Can you please provide some code so maybe I can help for you. Because If you write down that have you done it's not helping maybe you did good just you missed a part from the code







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 10 at 16:26









Romeo Berenyi

63




63












  • Thanks Romeo, please see my edit for the code.
    – monalisa
    Nov 11 at 20:45


















  • Thanks Romeo, please see my edit for the code.
    – monalisa
    Nov 11 at 20:45
















Thanks Romeo, please see my edit for the code.
– monalisa
Nov 11 at 20:45




Thanks Romeo, please see my edit for the code.
– monalisa
Nov 11 at 20:45


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233785%2fdelete-row-from-radgrid-and-refresh-page%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Schultheiß

Verwaltungsgliederung Dänemarks

Liste der Kulturdenkmale in Wilsdruff