I was trying to embed an asp.net video control using my visual web developer 2008 express ed. which originally doesn't have a built-in asp.net video control on its toolbox. I added the asp.net video control on the toolbox after I extracted the zip compressed folder that I downloaded. I was able to add the three asp.net video controls(WindowsMedia,Realplayer,Quicktime) from the downloaded files on the toolbox. At first, it was working when I tried to drag the WindowsMedia control from the toolbox onto the page but suddenly when I changed it using Realplayer it will now display an Error Creating Control on the control after dragging into the page. The error says:
The server tag 'ASPNetVideo:RealPlayer' is ambiguous. Please modify
the associated registration that is causing ambiguity and pick a new
tag prefix.
So, I keep on changing the control from WindowsMedia to Quicktime and still giving the same error. Here's my source code below for more reference:
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%# Register assembly="ASPNetVideo.NET2.AJAX" namespace="ASPNetVideo" tagprefix="ASPNetVideo" %>
<%# Register assembly="ASPNetVideo.NET3" namespace="ASPNetVideo" tagprefix="ASPNetVideo" %>
<%# Register assembly="System.Web.Extensions" namespace="System.Web.UI" tagprefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div id = "mydiv" runat="server">
<br />
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<asp:Button ID="Button1" runat="server" Text="Upload" Width="82px" OnClick = "Button1_Click" />
<br />
<br />
<br />
<ASPNetVideo:RealPlayer ID="RealPlayer1" runat="server" >
</ASPNetVideo:RealPlayer>
<br />
</div>
</form>
</body>
</html>
Please advise...Thanks.
<%# Register assembly="ASPNetVideo.NET2.AJAX" namespace="ASPNetVideo" tagprefix="ASPNetVideo" %>
<%# Register assembly="ASPNetVideo.NET3" namespace="ASPNetVideo" tagprefix="ASPNetVideo" %>
RealPlayer is most probably defined in both those assemblies. Try with only one of them and remove the other register.
You can also assign different namespaces to the two assemblies and then you wouldn't be getting an error once you resolve the ambiguity:
<%# Register assembly="ASPNetVideo.NET2.AJAX" namespace="ASPNetVideo" tagprefix="ASPNetVideo" %>
<%# Register assembly="ASPNetVideo.NET3" namespace="ASPNetVideo2" tagprefix="ASPNetVideo" %>
Related
I have googled and have search this forum, i can not find solution to my problem. As stated by the title in my webforms project using vs 2015 both these mentioned controls are causing a full page post back after uploading is done. In my other projects this works fine. But in this particular one i cant figure it out. Is there just a common thing I am over looking, I have created fresh pages with out using the master-page I still get the same results - full post back. I did not post my code because i am using the controls as any other programmer would.
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="pic1.aspx.cs"
Inherits="SSWebAppV1._1.pic1" %>
<%# Register Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
Width="500px" AllowedFileTypes="jpg,jpeg,png" MaximumNumberOfFiles="4"
OnUploadComplete="AjaxFileUpload1_UploadComplete" />
</div>
</form>
</body>
</html>
****code-behind***
protected void AjaxFileUpload1_UploadComplete(object sender,
AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
string fileName = Path.GetFileName(e.FileName);
AjaxFileUpload1.SaveAs(Server.MapPath("~/Eimages/" + fileName));
}
I am trying to develop an Ajax based website. where is installed ajax control toolkit on visual studio 2010. I created a page.
Here is the code
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="test2.aspx.cs" Inherits="QMSStandard.test2" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1">
</asp:CalendarExtender>
</div>
</form>
when I run this page its shows error
Error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure
the correct version of the scripts are referenced. If you are using an
ASP.NET ScriptManager, switch to the ToolkitScriptManager in
AjaxControlToolkit.dll.
Kindly suggest how can i use these controls.
first remove <asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager> and then drag and drop <asp:ToolkitScriptManager> from Ajax Toolbox control
I have a Default.aspx and a web user control that adds in Default.aspx
Is there any way that i can change value of a div in Default.aspx from web user control?
for example :
<meta name="description" content="" id="MetaDescription" runat="server"/>
<meta name="keywords" content="" id="MetaKeywords" runat="server"/>
or :
<div id="test" runat="server"></div>
Thank you
You can change value of parent page's any control, I made my sample for label control by using the following code. I have made one sample please check it.
Main Page ASPX:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="UseUsercontrol.WebForm1" %>
<%# Register TagPrefix="My" TagName="UserInfoBoxControl" Src="~/WebUserControl1.ascx" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<My:UserInfoBoxControl runat="server" ID="MyUserInfoBoxControl" />
<asp:Label ID="Label1" runat="server" Text="Main Page"></asp:Label>
</div>
</form>
</body>
</html>
User control ASCX:
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="UseUsercontrol.WebUserControl1" %>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
User Control CS:
protected void Button1_Click(object sender, EventArgs e)
{
Label parentPanel = this.Parent.FindControl("Label1") as Label;
parentPanel.Text = TextBox1.Text;
}
Here i am updating parent page's Label control value with child's textbox latest value which enter by user.
Hope it will help you. if i am going wrong then please let me know i will try to update it.
You can access a dive from codebehind but you cannot manipulate it's inner html.
If you want to ad a div and it's inner html from codebehid,
Create a user control and add a literal control
<asp:Literal Text="" ID="literal" runat="server" />
Add it to the aspx page
From the code behind of the aspx page,
Literal litereal = MyUserControl1.FindControl("literal") as Literal;
litereal.Text = string.Format("<div id=\"test\" runat=\"server\">{0}</div>", "any text or html");
I've downloaded DropDownCheckBoxList control from it's official page.
I've created new WebSite inside Visual Studio 2012 using File -> New -> WebSite and I added dll into references.
Then inside Default.aspx I've added this sample code:
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%# Register TagPrefix="asp" Namespace="Saplin.Controls" Assembly="DropDownCheckBoxes" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownCheckBoxes ID="checkBoxes2" runat="server">
<Style SelectBoxWidth="300" />
<Items>
<asp:ListItem Text="Option 1" Value="1" />
<asp:ListItem Text="Option 2" Value="2" />
</Items>
</asp:DropDownCheckBoxes>
</div>
</form>
</body>
</html>
After starting debugger my web site is displayed, but when using element inspector in Chrome I noticed that DropDownCheckBoxes isn't rendering value field for checkboxes:
Inside download package that comes with DropDownCheckBoxList is sample project, when I start it I can see that value field is rendered:
It's my fourth hour trying to figure out what is wrong with my code!
How should I create WebSite or WebApplication to have value field rendered?
After another 4 hour searching over SO I found awesome answer:
https://stackoverflow.com/a/15030781/965722
When below entry is added into web.config value isn't rendered
<pages controlRenderingCompatibilityVersion="3.5">
So removing it instantly solved my problems.
I have had this problem for a while now and no matter what i cannot seem to resolve it. I have a master page and a content page.
The content page simply contains a button
<%# Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</asp:Content>
The master page simply contains the content place holders. The button1 one event fires normally, however as soon as a form is added to the master page the button stops firing. the master page looks something like this
<%# Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
Member Login
<asp:Button ID="btnLogin" runat="server" Text="Login" CssClass="bt_login"
onclick="btnLogin_Click" />
</form>
</div>
</div>
</div>
</div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</form>
Can some one please help, the button works fine without the form in teh master page, however i need a form in the master page
Thanks
Ok after running the exact same project on another machine, everything worked fine. So I'm guessing there is an issue with the way i installed visual studio and asp.net.