Click here to Skip to main content
16,005,038 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Need help with Single Sign On (SSO) Pin
Christian Graus23-Jul-07 10:44
protectorChristian Graus23-Jul-07 10:44 
QuestionButton Click Event Pin
Civic0623-Jul-07 9:13
Civic0623-Jul-07 9:13 
AnswerRe: Button Click Event Pin
Amit Kumar G23-Jul-07 9:15
Amit Kumar G23-Jul-07 9:15 
GeneralRe: Button Click Event Pin
Civic0623-Jul-07 9:21
Civic0623-Jul-07 9:21 
GeneralRe: Button Click Event Pin
Amit Kumar G23-Jul-07 9:31
Amit Kumar G23-Jul-07 9:31 
GeneralRe: Button Click Event Pin
Civic0623-Jul-07 10:17
Civic0623-Jul-07 10:17 
GeneralRe: Button Click Event Pin
Amit Kumar G23-Jul-07 10:19
Amit Kumar G23-Jul-07 10:19 
QuestionF5 Refersh/Button Click [modified] Pin
Amit Kumar G23-Jul-07 7:50
Amit Kumar G23-Jul-07 7:50 
When an user clicks on a button click event and after the event got executed, if he hits on F5 key or Refresh button, the same button click event executes once again. How i can avoid this in ASP.Net 2.0.?

Moreover i clear all the controls, so that it should fire javascript for mandatory fields. Instread of that it is rerading the values from cache.....

I tried Button, HTML Submit and as well as ImageButton....But same behaviour....

Source Code:
public partial class RepeaterFormControl : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GetDataFromDatabase();
if (!(IsPostBack))
{
Button1.Attributes.Add("onclick", "return ValidateInput();");

}
}


private void GetDataFromDatabase()
{
SQLDataAccessHelper daHelper = new SQLDataAccessHelper();
this.Repeater1.DataSource=daHelper.ExecuteReader(CommandType.StoredProcedure, "GetFormViewData");
this.Repeater1.DataBind();
}


protected void clearControls()
{

((TextBox)(FormView1.FindControl("TxtFName"))).Text = "";
((TextBox)(FormView1.FindControl("TxtLName"))).Text = "";
((TextBox)(FormView1.FindControl("TxtEmail"))).Text = "";
((TextBox)(FormView1.FindControl("TxtDob"))).Text = "";
}
protected void btnSave_Click(object sender, ImageClickEventArgs e)
{
String sFname = ((TextBox)(FormView1.FindControl("TxtFName"))).Text.ToString();
String sLname = ((TextBox)(FormView1.FindControl("TxtLName"))).Text.ToString();
String sEmail = ((TextBox)(FormView1.FindControl("TxtEmail"))).Text.ToString();
string sDOB = ((TextBox)(FormView1.FindControl("TxtDob"))).Text.ToString();
String sCountry = ((DropDownList)(FormView1.FindControl("CmbCountry"))).SelectedItem.Text.ToString();


SQLDataAccessHelper daHelper = new SQLDataAccessHelper();
IDataParameter[] objparam;

objparam = daHelper.GetSpParameterSet("AddFormViewData");
objparam[0].Value = sFname;
objparam[1].Value = sLname;

objparam[2].Value = sEmail;
objparam[3].Value = sDOB;
objparam[4].Value = sCountry;

daHelper.ExecuteNonQuery("AddFormViewData", objparam);
GetDataFromDatabase();
clearControls();
sFname = "";
sLname = "";
sEmail = "";
sDOB = "";
}
}
And ASPX code....
<asp:imagebutton id="btnSave" runat="server" ImageUrl="Images/btnsave.gif" tabIndex="10" Width="82px" OnClick="btnSave_Click"></asp:imagebutton>

Thanks
Amit



-- modified at 14:43 Monday 23rd July, 2007
AnswerRe: F5 Refersh/Button Click Pin
Amit Kumar G23-Jul-07 10:20
Amit Kumar G23-Jul-07 10:20 
QuestionIIS 7.0 Pin
kibromg23-Jul-07 7:04
kibromg23-Jul-07 7:04 
AnswerRe: IIS 7.0 Pin
Not Active23-Jul-07 8:21
mentorNot Active23-Jul-07 8:21 
GeneralRe: IIS 7.0 Pin
Paul Conrad23-Jul-07 8:54
professionalPaul Conrad23-Jul-07 8:54 
QuestionWindows Authentication Pin
kibromg23-Jul-07 6:32
kibromg23-Jul-07 6:32 
AnswerRe: Windows Authentication Pin
Not Active23-Jul-07 8:22
mentorNot Active23-Jul-07 8:22 
GeneralRe: Windows Authentication Pin
Paul Conrad23-Jul-07 8:55
professionalPaul Conrad23-Jul-07 8:55 
QuestionGrid View Question Pin
Mavericks523-Jul-07 5:09
Mavericks523-Jul-07 5:09 
AnswerRe: Grid View Question Pin
Mavericks523-Jul-07 5:57
Mavericks523-Jul-07 5:57 
GeneralRe: Grid View Question Pin
Not Active23-Jul-07 8:25
mentorNot Active23-Jul-07 8:25 
AnswerRe: Grid View Question Pin
kubben23-Jul-07 7:11
kubben23-Jul-07 7:11 
GeneralRe: Grid View Question Pin
Mavericks523-Jul-07 7:18
Mavericks523-Jul-07 7:18 
GeneralRe: Grid View Question Pin
kubben23-Jul-07 7:42
kubben23-Jul-07 7:42 
GeneralRe: Grid View Question Pin
Mavericks523-Jul-07 7:58
Mavericks523-Jul-07 7:58 
GeneralRe: Grid View Question Pin
kubben23-Jul-07 8:08
kubben23-Jul-07 8:08 
GeneralRe: Grid View Question Pin
Mavericks523-Jul-07 8:25
Mavericks523-Jul-07 8:25 
GeneralRe: Grid View Question Pin
kubben23-Jul-07 8:27
kubben23-Jul-07 8:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.