如何使用 onserverclick 事件发送参数
这是我的代码:
<a href="javascript:void(0)" ID="platformHyperLink" runat="server" class="platformElementHL" onserverclick='<%# platformHyperLink_Click("+Eval("PLATFORM_ID").ToString()+")"%>' />click</a>
服务器代码:
protected void platformHyperLink_Click(object sender, EventArgs e)
{
findDevice.Visible = true;
LinkButton lk = sender as LinkButton;
ClearAndHide(false);
findDevice.Visible = true;
DeviceSelectedValueHiddenField.Value = null;
ModelSelectedValueHiddenField.Value = null;
OsSelectedValueHiddenField.Value = null;
Label PlatformNameLabel = lk.NamingContainer.FindControl("PlatformNameLabel") as Label;
platformName = PlatformNameLabel.Text;
SelectYourDeviceLabel.Visible = true;
platformID = Convert.ToInt32(lk.CommandArgument.ToString());
DataTable DT = WebsiteDataHelper.GetPlatformDevice(platformID);
if (DT.Rows.Count == 0)
{
DeviceListBox.Visible = false;
// DeviceNoDataFound.Visible = true;
SelectYourDeviceLabel.Visible = false;
}
else
{
SelectYourDeviceLabel.Visible = true;
DeviceListBox.Visible = true;
// DeviceNoDataFound.Visible = false;
for (int i = 0; i < DT.Rows.Count; i++)
{
string text = DT.Rows[i]["DEVICE_NAME"].ToString();
string val = DT.Rows[i]["DEVICE_ID"].ToString();
RadListBoxItem item = new RadListBoxItem(text, val);
DeviceListBox.Items.Add(item);
}
}
}
问题是我无法访问platformHyperlink,我不知道为什么请帮助我