Dear All,
I am using bellow code to postback from JavaScript but it seems I am not getting the argument i pass.
public string postBackStr;
postBackStr = Page.ClientScript.GetPostBackEventReference(this, "myArgument");
textBox = cmbCo.FindControl("TextBox") as TextBox;
if (textBox != null)
{textBox.Attributes.Add("onblur", "return getMinistryCode(this);");
}
In javascript i have the function
function getMinistryCode(txt) {
var cmbSDURN = document.getElementById(document.getElementById('<%= this.cmbSDURN.ClientID %>').id + "_HiddenField");
if (cmbSDURN.value == 0) {
alert('Please Select SDURN');
<%= postBackStr %>
}
}
The postback occurs but i am getting cmbCo ClientID, let me mention that cmbCo is Ajax 3.5 ComboBox and I am assigning onblur.
And the code for argument value is
if (Page.IsPostBack)
{
string arg = Request["__EVENTTARGET"].ToString();
Response.Write(arg);
}
As i stated the arg return the clientID of cmbCo, how can i get the argument which i am passing through Client Script?
I found the solution by bellow.
if (Page.IsPostBack)
{
string arg = Request["__EVENTTARGET"].ToString();
if (arg.Equals(cmbSDURN.ClientID.Replace('_', '$')))
{