Click here to Skip to main content
15,843,623 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Sir,

I am performing insert the data into database using linq to sqlserver on Click Submit Button, But after click on submit page is refreshing , "i have checked by code that again and again calling get method" Please help me guys any solution u have ...

"I am using custom user control (Userreg.ascx) for filling data and submit button on Default.aspx page"

My Sample code is

private GeneralDetails GD = new GeneralDetails();

public int InsertRegDetails()

 GD.FirstName = txtFirstName.Text;
 GD.MiddleName = txtMiddleName.Text;
 GD.LastName = txtLastName.Text;


protected void LinkButton1_Click(object sender, EventArgs e)


           Status = RegInGeneral1.InsertRegDetails();

           dvMessage.Visible = true;
           dvReg.Visible = false;
           ShowMessage1.Success = SessionVariables.MsgSuccessfulyReg;
           ShowMessage1.Failure = SessionVariables.MsgAlreadtReg;

           if (Status == 1)

               ShowMessage1.showSuccess = true;
               ShowMessage1.showSuccess = false;
               dvMessage.Visible = false;
               dvReg.Visible = true;


       catch (Exception ex)
           SessionVariables.ErrorMessage(DateTime.Now + " SessionId = " + Session.SessionID.ToString() + " ip = " + SessionVariables.IPAddress + "  Error Message:" + ex.Message);


Updated 5-Oct-11 2:55am
Herman<T>.Instance 5-Oct-11 7:53am    
each button click leads to a postback. So what code is in your Page_Load event? Do you use the check if(!Page.IsPostBack) in the Page_Load event ?

1 solution

on page load You should Be specify if(!Page.IsPostBack)
for more detail information follow this URL:[^]
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900