Click here to Skip to main content
16,019,055 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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); 
Posted
Updated 1-May-13 2:13am
v4
Comments
StianSandberg 23-Apr-13 7:43am    
This code is vulnerable for sql-injections! You should user sql-parameters instead of building your sql-query like that!

Try this:
You'll have to modify your loop also.. Style will not work in alert box. Try this:
C#
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
 
Share this answer
 
v3
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Dialog", "alert('" + Data + "');", true);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900