Configuration :: 2 Usercontrols With The Same Code Behind?
Jun 22, 2010
I have 2 usercontrols but the only idifferance is the layout, i created 2 .ascx files and only 1 .ascx.cs file, there is no compilation error, but when publishing i got error and i cannt publish I'm using VS 2008, Web Site Not web Application project and i dont have the choise to converting to Web Application.does anyone know how to solve it
View 3 Replies
Similar Messages:
Nov 22, 2010
We deployed a UserControl to our testing server. Then made a change to the UserControl and re-deployed. I cannot get the change to take. We have cycled the ASP.NET server, deleted the file completely and re-copied, and also tried a suggestion to change the web.config in order to force all files to be re-compiled.
I definitely know that we are changing the correct file. At one point, I removed the UserControl file altogether and received the "File not found error" when trying to load the user control. The file IS the correct version on the testing server.
[ASP.NET 4.0, Windows Server 2003 SP2, IIS (I think 6?)]
View 4 Replies
Sep 3, 2010
I have some user controls where I would like to add some javascript that uses Ajax and Jquery technology. Also these scripts should use Sys.WebForms.PageRequestManager.getInstance().add_endRequestand other functions of the Ajax framework.In the past I have added the related code to the hosting aspx page but it becomes a problem when re-using the same control in multiple aspx.
View 1 Replies
Sep 30, 2010
I tried using a codeblock syntax within a property sent to a web user control:
<uc1:MyControl ID="MyControl1" runat="server" SomeProperty="<%= somevalue %>"/>
The user control has the public property SomeProperty declared and also uses code block to display the property value:
<p><% = SomeProperty %></p>
The output on my page is unfortunately
<p><%= somevalue %></p>
And not the actual value. Anyone know of some workaround for this?
View 2 Replies
Sep 21, 2010
In one of my pages I use an usercontrol. The usercontrol has a textbox and a button on it. When someone adds text to the usercontrols textbox, I want to use the entered text in my page_init event. The problem is that in the page_init event, the textbox value is empty. How can I use the entered text in the page_init event?
View 13 Replies
Dec 15, 2010
I have several dynamic usercontrols that I want to load them in separete tab panles.but my problem is when the postback occures my usrecontrols diapeare.however I want to keep my usercontrols in each tab panle in each postback.I mention that I write code in c#.
View 30 Replies
Mar 8, 2010
I've posted a breakpoint in web user control. But Control is not going on breakpoint. Why is this happening.
I have done inline code.
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="IBlog.Web.HandleUserControl" %>
<script language="C#" runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Pagemenu.pageload();
}
public string Geturl(string url)
{
return Pagemenu.Geturl(url);
}
protected void menu1_MenuItemClick(object sender, MenuEventArgs e)
{
Pagemenu.menu1_MenuItemClick(sender, e);
}
//protected void Page_SelectedIndexChanged(object sender, EventArgs e)
//{
// Pagemenu.Page_SelectedIndexChanged(sender, e);
//}
//protected void MoreClick(object sender, EventArgs e)
//{
// DataList2.Visible = true;
//}
protected void lbmore_Click(object sender, EventArgs e) //this is the code i want to debug
{
}
</script>
<script type="text/javascript">
function mover()
{
var elem = document.getElementById("<%= DataList2.ClientID %>");
elem.style.display="block"
}
function mout()
{
var elem = document.getElementById("<%= DataList2.ClientID %>");
elem.style.display="none"
}
</script>
<div class="navi">
<div class="pages">
<ul>
<asp:DataList ID="DataList1" runat="server" RepeatDirection="Horizontal">
<ItemTemplate>
<li><a href='<%#Geturl((string)DataBinder.Eval(Container.DataItem, "URL"))%>'>
<%# DataBinder.Eval(Container.DataItem, "Title") %>
</a></li>
</ItemTemplate>
</asp:DataList>
</ul>
</div>
<asp:LinkButton ID="lbmore" runat="server" Text="More" OnClick="lbmore_Click"></asp:LinkButton>
<div class="pages2" id="more" runat="server">
<%--<a href="" onmouseover="mover()" onmouseout="mout()">More</a>--%>
<ul style="background-color: #626669; padding: 0 6px 0 6px; margin: 28px 0 0 0px">
<asp:DataList ID="DataList2" runat="server" Visible="false">
<ItemTemplate>
<li style="float: left;"><a href='<%#Geturl((string)DataBinder.Eval(Container.DataItem, "URL"))%>'>
<%# DataBinder.Eval(Container.DataItem, "Title") %>
</a></li>
</ItemTemplate>
<ItemStyle Wrap="True" />
</asp:DataList>
</ul>
</div>
</div>
View 1 Replies
Jan 27, 2010
Does anyone know a good way to embed user controls inside an assenbly so they can be reused across projects. I am not looking to create custom web controls. I have ascx files from different projects which I want to centrally use.
View 2 Replies
Jan 7, 2011
I am generating instances of a UserControl and putting them in an UL. In my UserControl there is a button with an event. I want to ask how I can keep the state of the UserControls I generated so that they remain on the page after a postback and also to catch their events.
For i As Integer = 0 To lstFoo.Count - 1
Dim liFoo As New HtmlGenericControl("li")
Dim ucMyFoo As ucFoo = LoadControl("userControls/ucFoo.ascx")
liFoo.Controls.Add(ucMyFoo)
ucMyFoo.DoSomething()
ulFoo.Controls.Add(liFoo)
Next
View 1 Replies
Jan 21, 2010
Let's say I have an a .ascx user control. How do I get its HTML markup into a string?
View 5 Replies
May 25, 2010
I have a complete web application code created by other developer using asp.net c#. I am trying to deploy it on IIS 7.5 on windows 7.
In this application, there is a root folder that contains very less code files & one web.config file. This code is online currently & when we open the url, it redirects to the sub folder which is
http://******.com/pages/home.aspx
On IIS when I try to open this same path locally as http://localhost/test_project/pages/home.aspx
it simply prints the code in browser as
<% Response.Redirect("Home.aspx"); %>
View 4 Replies
Dec 23, 2010
I have several dynamic user controls that I want to keep them in each postback. but the problem is when I click on menu item at first time, every thing disapeare in my page! even the things I created on design time. would somebody please help me to find out the problem of my code?it's realy urgent!!
[Code]....
View 13 Replies
May 25, 2010
We have two asp.net sites (based on episerver). Using Telerik Asp.net controls. We have some funtionality that we want to have availible in both sites. Right now one of the sites use webparts/usercontrols and the other uses usercontrols.
Is there any way to share the functionality between these sites? What I would like is to be able to share usercontrols between the sites.
View 3 Replies
Jun 29, 2010
We need to add 2 user controls to an aspx file, these 2 user controls have one telerik ajax manager each. but telerik only allows one ajax manager in a web page. I am getting exception while running the app.
Is there any way in aspx to seperate the user controls so that it will act as a seperate page?
View 1 Replies
Feb 25, 2010
I have an (almost) empty aspx page and I want to insert a certain number of the same user control in this page.
I tried to add them from the CodeBehind but it seems that the UserControls are completely empty.
In the main page (MainDiv is a div with runat="server"):
protected void Page_Init(object sender, EventArgs e)
{
WebUserControl1 uc = new WebUserControl1();
WebUserControl1 uc1 = new WebUserControl1();
MainDiv.Controls.Add(uc);
MainDiv.Controls.Add(uc1);
}
(it doesn't work if i put this code on Page_Init, Page_Load or Page_PreRender)
UserControl (gw is a Gridview contained in the UserControl):
protected void Page_PreRender(object sender, EventArgs e)
{
if (_data != null)
{
gw.DataSource = _data;
gw.DataBind();
}
}
when I arrive there, gw is null (this.Controls.Count is 0).
View 1 Replies
Jan 17, 2011
As the title says , i'm looking for some kind of technology that allows me to dynamicly add & remove usercontrols.Without a postback ofcourse :)A link would be awesome , example code would be super!
View 1 Replies
Mar 9, 2010
First off - has any recent .NET / Windows Service Pack / Windows Update changed the behaviour around the Visibility of Panels / User Controls? An area of our site has all of a sudden stopped working. The most recent change that I made was a few weeks ago, I've backed out the change from my development environment, but the issue is still happening.
I'll explain what is happening. I have a couple of forms where the same behaviour is happening, but they follow the same pattern:
On the form there is let's say 2 ASP:Panel controls. In each of these there is a separate ASP:UserControl. When the User first visits the page, they are shown the first Panel and User Control. On this control they complete a couple of steps and click Next. This fires an event on the main page, which hides the first panel and shows the second panel, at least that is what is supposed to happen - and if I debug and step into the code this is what is happening as normal. Except on screen, the first panel is no longer being hidden, so it would appear clicking the Next button does nothing.
I'm at a loss as to what has happening - nothing has changed, and stepping through the code it's working correctly, but the screen is not reflecting what is happening in the code.
My next step is to create an isolated set of test pages to recreate the issue. Will attach when done and investigated, hopefully this will solve it
View 1 Replies
Aug 27, 2010
Is it necessary to reload the viewstate of usercontrols during postback? I want to know in which case viewstate is set by default.
View 2 Replies
Feb 22, 2011
We have some problem in develepment server so we didnt recover the our project source code (asp.net 1.x with C#). now i have downloaded the files from the production server but the production server doesnt have the C# source code. its contain only the .dll file (singe dll file for all the aspx.cs and .cs classes) and design files. we need to update some functionalities in my project,so can i get .aspx.cs and .cs clasess from the project .dll? or how can i modify the clacess without source(.cs,.aspx.cs)?
View 1 Replies
Sep 22, 2010
If I deploy my ASP.NET project to a shared server web hosting, then is there a way to secure my source files so that the provider will not be able to access the source?. For example, the provider of my web hosting may download my files and then he will be able to get access to all my source.
View 9 Replies
Sep 18, 2010
I get the dreaded "the compiler failed with error code 1" error message when application starts. Sometimes, it does not even start and in VS 2008 I get:"Could not load file or assembly 'file///C:WindowsMicrosoft.NetFrameworv2.0.50727Temporary ASP.NET FilesInternal2d7d8a83649918fApp_Web_timecard.aspx.3ecd542a.aa9wycbd.dll' or one of its dependencies. The system cnnot find teh file specified"I have searched for this error and tried everything suggested to no avail. I deleted the "Internal" folder in Temporary ASP.NET Files folder, changed something in one of teh file and also in web.config to force a recompile and restared IIS. Same thing happens. I checked all the files and do not a circular definition/referencing.
View 2 Replies
Jan 31, 2011
How is this achieved so that my source code is protected as put on a server other people have access to?
View 6 Replies
Mar 8, 2011
i am trying to run/build a basic with vb.net as code behind. I am assuming the code behind for global.asax will be called Global.asax.vb
here is what i have for global.asax
<%@ Application Codebehind="Global.cs"
Inherits="Dalmar.Global"
%>
View 4 Replies
Sep 26, 2010
I can't see anything about this in the forum, yet it's a problem I have both on my VPS demo box and on some live boxes too:
When I deploy anything requiring a re-compile (e.g. not just an aspx.cs, but a .cs file) about once in every three times, IIS crashes.
This then requires not just a restart of IIS, but a reboot of the entire server, to bring it back again. If I try to restart just IIS, it won't actually "stop", so it won't then start again.
I therefore try to only deploy updates late at night, but in urgent situations a problem which needs rectifying can be made much worse by an additional 5 minutes of hard downtime while the box reboots. I can't predict when this will happen, but now warn all my clients against any updates during "office hours".
Is this a known bug/fault - can I get around this, preferably not by using RDP and stopping IIS completely before I FTP the files across?
Both boxes are 32 bit Windows Web Server.
View 6 Replies
Mar 23, 2011
I'm creating a multi-tenant Asp.Net MVC 3 Web app, and using EF4.1 code first for the db model.For development I'm happy to use SqlServerCE in App_Data, and for production this will move to Sql Server 2008.
Say my context is called "MyModels", by default code-first looks for a connection string called "MyModels" in Web.config. This can be told to use a file in App_Data or changed to access a database in SQL2008. All fine so far.
But because of multi-tenancy, I'd like the SqlServerCE filename to match the unique id of the tenant (so App_Data would have "client_x.sdf", "client_y.sdf"; Sql Server 2008 would have separate databases). I can't work out how to direct to these different databases.
I've tried MyModels inheriting from DbContext and supplying a connection string (using a 'placeholder' conn string in Web.config and replacing "{clientId}" with the unique id), and I've also tried setting the connection string in the MyModels constructor:
base.Database.Connection.ConnectionString = xxx;
but this never seems to work. I always get the following error:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
( it's not yet 'configured' to use SqlServerCE, and so is trying to connect to Sql Server)
Tracing the code, Database.Connection.ConnectionString hasn't been read from Web.config at this point, so I can't search and replace that, and, possibly, it's getting overwritten by the 'placeholder' conn string later in the pipeline.I reckon this must be quite straightforward and I just can't find the 'hook'.
View 2 Replies