Good day Everyone,
The following is part of my code
protected void Button1_Click(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script>loadAdditionalInfoDialog(info1)</script>",false);
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp2", "<script>loadAdditionalInfoDialog(info2)</script>",false);
}
The loadAdditionalInfoDialog() function will prompt a small window and let user to key in some info and then click on "OK" button to proceed to next step.
But, when I click on Button1, I can only see the secoond RegisterStartupScript, which is loadAdditionalInfoDialog(info2) works, it will prompt the small window, and I can key in some info and click on "OK" button to proceed to next step.
Because of this, I CAN NOT enter info for the first RegisterStartupScript, which is loadAdditionalInfoDialog(info1).
Would like to ask for solution which is, when I click on Button1, I can first enter info for loadAdditionalInfoDialog(info1) and then click on "OK" button, then continue enter info for loadAdditionalInfoDialog(info2).
Thousand of thanks.
Improve question here (code for loadAdditionalInfoDialog() in front page: )
<script>
function loadAdditionalInfoDialog(info)
{
if (info == "")
alert("Please fill in quantity");
}
else
document.getElementById("<%=btn3InfoRefresh.ClientID %>").click();
</script>
// start btn3InfoRefresh code
protected void btn3InfoRefresh_Click(object sender, EventArgs e)
{
ucForm.ProductID = int.Parse(hid3InfoProductID.Value);
ucForm.Values.Clear();
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp"+i, "<script>showAdditionalInfoDialog();</script>", false);
}
// end of code
The showAdditionalInfoDialog() is a function to pop out a window to let user key in information and click ok "OK" button to proceed to next step.
// start showAdditionalInfoDialog code
function showAdditionalInfoDialog()
{
document.getElementById("<%=divAdditionalInfo.ClientID %>").style.visibility = "visible";
document.getElementById("<%=divAdditionalInfo.ClientID %>").style.display = "table-cell";
}
// end of code
I will do some improvement on my question because it make people confuse.
Actually the Button1_Click is just a button I create to do testing.
In fact, I only will call the loadAdditionalInfoDialog() when I get data in a Repeater :
protected void btnRedeemAll_Click(object sender, EventArgs e)
{
foreach( RepeaterItem itm in repGiftResults.Items )
{
if (pr.AdditionalFieldsEnabled == true)
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script>loadAdditionalInfoDialog(1," + pr.ID + "," + giftId + ",'" + txtQty.ClientID + "'," + tokenId + ")</script>", false);
}
}
}
Thus, I think it is hard for me to call the second time loadAdditonalInfoDialog() when I click on "OK" button, because I need to get many parameter in the repeater.