如何在C#中直接传递ScriptManager.RegisterClientScriptBlock中的字符串值 [英] How to pass string values in ScriptManager.RegisterClientScriptBlock directly in C#

查看:256
本文介绍了如何在C#中直接传递ScriptManager.RegisterClientScriptBlock中的字符串值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Geeks



只是一个小小的验证。字符串值不会完全传递给下面的代码。

这是错的吗?



Hi Geeks

Just a small verification. string values doesn't pass exactly to the below code.
Is this wrong?

string characters="/;*?<>|";             
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('A file Name cant contain any of the operators'"+characters+"')", true); 





建议我如何传递字符串值?



提前致谢



Suggest me how to pass string values?

Thanks in advance

推荐答案

试试这个:

Try this:
string script = @"alert('A file name cannot contain any of the operators \'/;*?<>|\'')";
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", script, true);


这篇关于如何在C#中直接传递ScriptManager.RegisterClientScriptBlock中的字符串值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆