方法中Asp.net中的java脚本 [英] java script in Asp.net in method

查看:105
本文介绍了方法中Asp.net中的java脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public string Activity(string FK_User)
        {
            SqlDataAdapter xDA = new SqlDataAdapter("select * from tblActivtyLog where FK_UserID='"+FK_User+"'", xconn);
            DataTable xDT = new DataTable();
            xDA.Fill(xDT);
            string Data = "";
            for (int i = 0; i < xDT.Rows.Count; i++)
            {
                Data += "<p style="\"color:" mode="hold" />;
                string Work = xDT.Rows[i][3].ToString();

            }
                ScriptManager.RegisterStartupScript(this, typeof(String), "Dialog", Data, true);
            return "Your Activties";
        }

 //this line is showing error can someone help me please
 ScriptManager.RegisterStartupScript(this, typeof(String), "Dialog", Data, true); 

推荐答案

试试这个:

你也必须修改你的循环..样式不会在警报框中工作。试试这个:

Try this:
You''ll have to modify your loop also.. Style will not work in alert box. Try this:
for (int i = 0; i < xDT.Rows.Count; i++)
{
    Data += xDT.Rows[i][3].ToString();

}
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Dialog", "alert('" + Data + "');", true);





--Amit



--Amit


ScriptManager.RegisterClientScriptBlock(this,this.GetType(),Dialog,alert(''+ Data +'');,true);
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Dialog", "alert(''" + Data + "'');", true);


这篇关于方法中Asp.net中的java脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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