Hi,
I need to call a code behind Method from javascript which is used to bind invoice no based on Job ID which is a Foreign key. Below is the code which is used for calling, while the asp.net page is loaded for the first time, this is working fine. Here the problem is LoadInvoiceForJob is a method which is called in javascript, which is as follows:
function LoadInvoiceJobs() {
var e = document.getElementById('<%= txtRefDocID.ClientID %>').value;
if (e > 0) {
callInv();
}
}
function callInv() {
'<%= LoadInvoiceForJob() %>';
}
below is the code behind, if i run this page return empty string while page is loaded first time, the script is showing me the empty value on html page source too. But when i try to send the string as <%= LoadInvoiceForJob %>, this is not doing any action. txtRefDocID holds a value, which is hidden control
protected string LoadInvoiceForJob()
{
LoadInvoiceNo(txtRefDocID.Value);
return "<%= LoadInvoiceForJob(); %>";
}
private void LoadInvoiceNo(string JobID)
{
cmbInvoiceNo.Items.Clear();
cmbInvoiceNo.SelectedItemIndex = -1;
DataTable dt;
dt = new DataTable();
dt = _Inv.GetInvoiceNoByJob(JobID);
cmbInvoiceNo.TextField = "InvoiceNo";
cmbInvoiceNo.ValueField = "InvoiceID";
cmbInvoiceNo.DataSource = dt;
cmbInvoiceNo.DataBind();
cmbInvoiceNo.CurrentValue = "";
}
Any help would be appreciated.
Thanks in Advance!!