Question : postback issue

when a button inside listview is clicked then i call for this sub RetriveCustomerInfo()

this sub fills my form on same page.    when i hit the submit form in the form , my data is updating but with data retrieved from sub and not from new updated data.  

how can i make so my form adds new data to db instead of what was retrieved from sub.  

Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
Private Sub ListView1_ItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewCommandEventArgs) Handles ListView1.ItemCommand
        '  Dim btn As Button = CType(sender, Button)
        If e.CommandName = "update1" Then
            ImageButton1.Visible = False
            ImageButton3.Visible = True
            argumento = e.CommandArgument
            RetriveCustomerInfo()
            'Response.Redirect("omcswelcome.aspx?edit=" + e.CommandArgument)
            'Exit Sub


            pnladdnote.Visible = True

        End If

    End Sub

Answer : postback issue

The function you are calling for setting the db values to page must be called inside !IsPostBack
1:
2:
3:
4:
if(!IsPostBack)
{
//Call you function to set the db values to form
}
Random Solutions  
 
programming4us programming4us