inActiveAffiliates returns empty value.it doesnot enters in onTextChanged event
function checkInActiveAffiliate() {
var IsValid = false;
var inActiveAffiliates = $('[id*=hdnInActiveAffiliates]').val();
if (parseInt(inActiveAffiliates) > 0) {
if (confirm('Do you want to approve application which contains inactive affiliate?')) {
IsValid = true;
}
}
return IsValid;
}
<asp:ImageButton ID="ibtApprove" align="absmiddle" runat="server" ImageUrl="~/Images/btn_Approve.gif"
ToolTip="Approve" OnClick="ibtApprove_Click" OnClientClick="return checkInActiveAffiliate()" Style="height: 18px; display: none">
</asp:ImageButton>
<asp:TextBox ID="txtRequestedAffiliate" runat="server" CssClass="inpTxt" Width="90%" ReadOnly="true"
OnTextChanged="txtRequestedAffiliate_TextChange" AutoPostBack="true"></asp:TextBox>
<asp:HiddenField ID="hdnInActiveAffiliates" runat="server" />
protected void ibtApprove_Click(object sender, ImageClickEventArgs e)
{
//string otherAffiliateName = txtRequestedAffiliate.Text;
//int inActiveAffiliates = new BLRating().InActiveAAffiliateChecking(otherAffiliateName);
//if (inActiveAffiliates > 0)
//{
// // ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "confirm('Do you want to approve application which contains in active affiliate?');", true);
// ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "checkInActiveAffiliate();", false);
//}
int intSuccess = new BLRating().ApproveApplication(intAppNo, Session["UserId"].ToString());
if (intSuccess > 0)
{
Hashtable htLog = new Hashtable();
htLog["AppNo"] = intAppNo.ToString();
htLog["ActivityLogId"] = "28";
htLog["Description"] = "Application BMO -" + intAppNo + " Approved";
htLog["UserId"] = Session["UserId"].ToString();
htLog["Status"] = hdnStatus.Value.ToString();
new BLLogDetails().InsertLogDetails(htLog);
Page.RegisterStartupScript("alert", "<script>Reload()</script>");
}
}
protected void txtRequestedAffiliate_TextChange(object sender, EventArgs e)
{
string otherAffiliateName = txtRequestedAffiliate.Text;
int inActiveAffiliates = new BLRating().InActiveAAffiliateChecking(otherAffiliateName);
hdnInActiveAffiliates.Value = inActiveAffiliates.ToString();
}
this is the code used