Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Why the error is giving "The name 'ScriptManager' does not exist in the current context" in the following line.How to define script manager
 

<html>
<head>
<title>Entry for notification</title>
<script type="text/javascript">
function Showalert(username) {
alert(username + ' details updated successfully.');
}
 
My HTML Code is given below
</head>
<body>
<script src="../nicEdit.js" type="text/javascript"></script>
<script type="text/javascript">
bkLib.onDomLoaded(function() {
['fontSize','bold','italic','underline','strikeThrough','subscript','superscript','html','image']}).panelInstance('area4');
new nicEditor({maxHeight : 400}).panelInstance('ta1');
});
</script>
<form  runat="server">
<textarea style="height: 100px;" cols="80" id="ta1"  runat="server"></textarea><br><br>
<asp:Button ID="b1" Text="Submit" OnClick="submit" runat="server"/>
</form>
</body></html>
 
 
My CS Code is given below
 
<%@ Page validateRequest="false" Debug="True"%>
<%@Import Namespace="System.Data"%>
<%@Import Namespace="System.Data.OleDb"%>
<script  runat="server" language="c#">
OleDbConnection con;
OleDbCommand com;
OleDbDataAdapter da;
DataSet ds;
string a1,st;
 
void page_Load(Object sender,EventArgs e)
{
con=new OleDbConnection();
con.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/nicedit/adv_web.mdb") + "";
con.Open();
ds=new DataSet();
string sql="select * from notification";
da=new OleDbDataAdapter(sql,con);
da.Fill(ds,"notification");
}
void submit(Object sender, EventArgs e)
{
con.Open();
com=con.CreateCommand();
com.CommandText="UPDATE notification SET notice = '" + ta1.Value + "' where id='" + 1 + "'";
int result= com.ExecuteNonQuery();
con.Close();
if(result==1)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowSuccess", "javascript:Showalert('"+ta1.Value+"')", true);
}
}
</script>
 
Posted 15-Feb-12 23:25pm
Edited 15-Feb-12 23:30pm
v2
Comments
NikulDarji at 16-Feb-12 4:31am
   
pre tag added.....

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

include following code inside the form
<asp:scriptmanager id="ScriptManager1" runat="server"/>
  Permalink  
v2
Comments
Janardan Pandey at 16-Feb-12 4:41am
   
Error is giving: Unknown server tag 'asp:ScriptManager'
digimanus at 16-Feb-12 4:49am
   
place that line of code inside your form tags
Jeevitha royapathi at 16-Feb-12 6:50am
   
Use NameSpace "System.Web.UI" in cs page
 
and remove this code from design page
<asp:scriptmanager id="ScriptManager1" runat="server"/>
blue_developer at 20-Sep-12 10:33am
   
Thank you Jeevitha!!
That worked for me.
Cheers. ;]

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

  Print Answers RSS
0 Mathew Soji 334
1 Maciej Los 295
2 BillWoodruff 290
3 Afzaal Ahmad Zeeshan 257
4 DamithSL 225
0 OriginalGriff 6,369
1 Sergey Alexandrovich Kryukov 5,973
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,045


Advertise | Privacy | Mobile
Web04 | 2.8.1411019.1 | Last Updated 16 Feb 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100