[英]OnClientClick not working First Time
每当我第一次单击图像按钮时,我都会尝试在图像按钮onClientClick事件上将PDF文件打开到新窗口中,而当我尝试第二次单击它将将文件打开到新窗口中时,我只想打开文件第一次点击
我用下面提到的代码。
//Find control in Grid view
GridViewRow row = (GridViewRow (((ImageButton)e.CommandSource).NamingContainer);
HiddenField hdnFileName = (HiddenField)row.FindControl("hdnFilePath");
ImageButton ibtn = (ImageButton)row.FindControl("ibtnDownload");
//Get File Path and FileName and Concate
string strFilePath = "\\OnlineContent\\";
string filePath = strFilePath +"/"+ hdnFileName.Value;
//Open PDF file into new tab
ibtn.OnClientClick = "window.open('"+filePath.ToString()+"','target=_blank');";
在\\ OnlineContent之前使用..(双点)或〜(波浪号)。
字符串strFilePath =“ \\ OnlineContent \\”; 字符串filePath = strFilePath +“ /” + hdnFileName.Value;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.