[英]Undefined is not a valid value for int64
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和 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();
此行抛出错误
grdResources.DataBind();
. . I don't understand what to do here?
我不明白在这里做什么? Please help
请帮忙
I figured it out.我想到了。 I changed this
我改变了这个
var field = document.getElementById('<%= hfResourceID.ClientID %>');
to this对此
var field = document.getElementById('<%= hfResourceID.ClientID %>').value;
in javascript function.在 javascript function 中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.