(我试图将我的麻烦土耳其语翻译成英语。“JavaScriptçalışmazamanıhatası:Tanımsızveyaboşreferansın'value'özelliğiayarlanamıyor”in Turkish。我写这篇文章以便更好地了解我,如果你懂土耳其语) 我尝试将选定的gridview行的信息传递给Datalist的ItemTemplate表,代码为
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
foreach (GridViewRow row in GridViewVehicleList.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
// set the last parameter to true
// to register for event validation.
row.Attributes["onclick"] =
ClientScript.GetPostBackClientHyperlink(GridViewVehicleList,
"select$" + row.DataItemIndex, true);
}
}
base.Render(writer);
}
protected void OnRowSelected(object sender, GridViewSelectEventArgs e)
{
// Get the datakey of the selected row
var id = Convert.ToInt32(GridViewVehicleList.DataKeys[e.NewSelectedIndex].Value);
var id2 = Convert.ToInt32(GridViewVehicleList.DataKeys[e.NewSelectedIndex].Values[1]);
SqlDataSourceVehicleListForDatalist.SelectCommand = string.Format("SELECT *" +
" FROM CURRENTDATA WHERE DATEANDTIME = {0} AND RFID = {1}", id,id2 );
DataListVehicleList.DataBind();
MultiView1.ActiveViewIndex = 4;
}
但我犯了上面的错误
如何克服这个问题
全部谢谢
答案 0 :(得分:0)
我认为问题在于您从本地资源文件获取对象。可以在code behind
中,也可以在JS
中。正确检查GetLocalResourceObject("key")
字符串是否在资源文件中退出并具有值。