I came across this error recently and I don't understand what to do
There is a hidden filed
<asp:hiddenfield id="hfResourceID" runat="server" value="0">
and I am collecting this value like
long resourceId = Convert.ToInt64(hfResourceID.Value);
and the error comes here
private void searchGlobal()
{
enResourceType resourceType =
Request.QueryString["ResourceGroupType"] != string.Empty
? (enResourceType)Enum.ToObject(typeof(enResourceType),
Convert.ToInt16(Request.QueryString["ResourceGroupType"]))
: enResourceType.Both;
if(resourceType == enResourceType.Network &&
Request.QueryString["From"] == "GlobalResourceGroupRequest")
plhCreateNewNetwork.Visible = true;
string requestID = (Request.QueryString["RequestID"] != null) ?
(string)Request.QueryString["RequestID"] : "0";
grdResources.DataSourceID = "ResourceDataSource";
ResourceDataSource.SelectMethod = "SearchGlobal";
ResourceDataSource.SelectParameters.Clear();
ResourceDataSource.SelectParameters.Add("name", txtName.Text);
ResourceDataSource.SelectParameters.Add("requestID", requestID);
ResourceDataSource.SelectParameters.Add("resourceType", resourceType.ToString());
ResourceDataSource.SelectParameters.Add("folioID", folioID.Text);
grdResources.DataBind();
}
and javascript function
function folio_OnClick(sourceID, request) {
var ret = openfolioPopup(resourceID, requestID);
var txtfolioID = document.getElementById('<%= txtfolioID.ClientID %>');
var txtfolio = document.getElementById('<%= txtfolio.ClientID %>');
var txtfolioName = document.getElementById('<%= txtfolioName.ClientID %>');
if (ret != undefined && ret[0] != 0) {
txtfolioID.value = ret[0];
txtfolio.value = ret[1];
txtfolioName.value = ret[1];
var field = document.getElementById('<%= hfID.ClientID %>');
field.value = reID;
__doPostBack('<%= btnfolio.UniqueID %>', '');
}
}
This line throws error grdResources.DataBind();. I don't understand what to do here? Please help