Custom Server Controls :: Loading Same Assembly For The Multiple Times?
Jan 25, 2010
Can you tell me how it is better to load classes from the same assembly for multiple times? I will explain:
I have a usercontrol that loads the class from assembly A.DLL using (MyAbstractClass)Assembly.Load(path).CreateInstance(type) each time requested page loads. The control can appear on the page many times (about 20-30) and each of them can load the different type from A.DLL...so if control exists on page 20 times, 20 times (MyAbstractClass)Assembly.Load(path).CreateInstance(type)
has been executed.
The question is performance...
Does ASP.NET caches DLLs already loaded dynamically? After first (MyAbstractClass)Assembly.Load(path).CreateInstance(type)and first IO, will ASP.NET load A.DLL from cache on other executions ? Or I need to implement some kind of assemblies caching myself?
If I need to implement caching myself, what is the best and fastest way to do it?
View 1 Replies
Similar Messages:
Jan 21, 2011
i want to apply my custom validator multiple times on a single property. i am using mvc 3 unobtrusive js for validations.i have tried this solution
http://www.paraesthesia.com/archive/2010/03/02/the-importance-of-typeid-in-asp.net-mvc-dataannotations-validation-attributes.aspx , but not working for me.I am getting error like this : "Validation type names in unobtrusive client validation rules must be unique."
View 7 Replies
May 17, 2010
I am creating custom server control. I have two classes in project. One is main class that render control and another will be used to render content based on condition.I just want to know how to render content from other classes in main class.For example. This isjust an example.My main class code
[Code]....
My TopLeftPane class
[Code]....
My page code on page load event
[Code]....
When I run the page, Header title always getting null. This is a just sample code. I will have more than 20 classes so I dont want to write a code in main class to render whole control.I hope all of you understand my problem.
View 3 Replies
Aug 17, 2010
I have created two composite controls in the same assembly and registered that assembly in a master page
using <%@
Register
tag.
When I try to use these controls using the registered tag prefix I am getting only one control along with the tagprefix .
How to get all the composite controls present in the registered assembly?
View 2 Replies
Aug 21, 2010
I have created a simple ASP.net Web Application (2.0) and have added a web user control.
Now in my page I have added this control but I have registered like this,
<%@ Register Assembly="WebApplication1" Namespace="WebApplication1" TagPrefix="Custom" %>
Which means I want to access all the controls in my current Web Application project
Then I have added my user control like this,
<Custom:MyUserControl ID="MyUserControl1" runat="server" PublicProperty="Hello" />
Every thing is fine but when I execute the project, NO control on my user control gets "instantiated" and thus I receive error "Object Reference Not Set"
Note that My Control has,
1) Public property PublicProperty as String
2) 1 Label control
In Load Event Handler I am setting Text property of Label Control to PublicProperty. Here object reference NOT set error occurs (which means Label control is NOT initialized).I don't want to register my control using Src, TagPrefix etc.
View 4 Replies
Mar 2, 2010
First, I would like to apologize, the search on the site wasn't working, so I don't know if I'm missing an existing post or not.
I have a web page that uses a master page file. I am using a third party control from Component One(TabStrip), the tabs are rendered as links on the final page. When a tab(link) is clicked, I need to load the appropriate web user control associated with that tab. Each web user control has its own post backs and methods. I know that I can load the controls on the "SelectionChanged" event of the TabStrip control, but then any postback created by the web user control that is loaded causes the page to refresh and the control was never loaded in viewstate. So, I tried to put my procedure of loading the web user control into the page_init method. This would work, if I could read which link was clicked on from within the page_init method. I tried using a javascript function to run "onclick" of the tabs and within it setting the value of a hidden control. I have verified that the javascript works and that the hidden control's value is getting set correctly. When I get into the page_init method, the value of the hidden control is not readable.
I'm tying to understand the page lifecycle to the fullest, but I don't see what I'm missing here. I know that I need to load the web user controls in the page_init method in order to persist the page as a whole, but how can I get which tab(link) was clicked to know which control should be loaded?
View 5 Replies
Mar 16, 2010
I have a ASP.NET 3.5 web application and I would like to allow users to install this web application multiple times on the same server.
--------
WebApp1 - database1
WebApp2 - database2
WebApp3 - database3
View 2 Replies
Feb 17, 2011
I need to access some data from a custom assembly. This custom assembly is used by an RDLC report in visual studio 2010. The report has its own data source but this is for a special condition. When I use ths code below the the text box on the report throws an error showing #ERROR. Its the database call that is causing the error as I have tested without the call. I have changed the connect string in the sample below to ans it shows the syntax.
View 3 Replies
Jan 15, 2010
System.Reflection.Assembly assembly = System.Reflection.Assembly.LoadFile(@"CustomControls.Nav.dll");
//Namespace and assembly name are CustomControls.Nav , the class name for the control is WebBar
Type type = assembly.GetType("CustomControls.Nav.WebBar");
I am getting type as null.What am I doing wrong here?
View 1 Replies
Mar 17, 2010
I have a control that displays a list of comments. The comments are created in a loop. The problem is that I want to put a LinkButton at the end of each comment and change the CommanArgument of each button to the ID of the current comment.
When I put the Linkbutton in the CreateChildControls method and then add the CommandArgument in the Render loop, the button works, but the argument is blank. When I put the code that's in the CreateChildControls method inside of the loop, I don't get an error, but nothing happens when the button is clicked.
Below is the relevent code ...
[Code]....
View 1 Replies
Dec 29, 2010
I have a 2 page signup form, on each page the form fields are seperated into sections. Each section is a user control, and there are 2 controls on each page. My question is, how do I get the data from page A to B. I'll be using a webservice to insert the data into SQL so I'm not worried about that portion of the process.
using System;
using System.Collections.Generic;
using System.Configuration; [code]....
View 2 Replies
Dec 10, 2010
I have a piece of code that is just HTML. It was previously created as a user control. Within the application i'm working with there are two seperate websites that are interlinked to make one website. There is a documents section where users do not need to login and a data section where users need to login. The design was implemented long before I was hired. My problem is I want to use the code from the documents website with the data website but I can't seem to register the control. I only one this piece of code in one place so when it is updated it doesn't have to be in multiple places. I tried setting "src=http://website/doc/doc.ascx" but this errors out saying
<%@ Register Src="http://website/doc/doc.ascx" TagName="docs" TagPrefix="temp" %>
Parser Error Message: The file '/documents/http://website/doc/doc.ascx' does not exist.
It adds the directory as part of the src. How can I have it point to this location http://website/doc/doc.ascx ?
View 7 Replies
Jan 5, 2010
[Code]....
I have a select statement that is supposed to be filling grid with information from an income table. It's only supposed to pull if the income is from the current fiscal year or is less than 1 year old. Currently, what it does is pull multiples of rows and also rows from past income years but only if there is a mixture. For instance, if a person has income from 2005 and 2010 what it will show is this
Income 2005
Income 2005
Income 2010
Income 2010
Income 2010
Does anyone know what I've done wrong? BTW, those results are exact, old income is shown twice, current is shown 3X
View 16 Replies
Jan 27, 2011
I have a simple UserControl that I've created that simply allows a user to enter the date. For the time being, it has a single Textbox with ID="tbDate". I am trying to dynamically add this control multiple times via (for example) `placeholder.Controls.Add(LoadControl())` but am receiving the error "An entry with the same key already exists". I could, perhaps, change the ID of the elements but then it would be difficult to grab the value entered by the user.
View 3 Replies
Aug 26, 2010
I have a simple form that inserts a record into a SQL table.
The fields are:
SerialNum
TagNum
PONum
Location
Address
Description
This works great. However, I have now been asked to have the form insert x number of records at one time.
They want to be able to fill out the following fields:
PONum
Location
Address
Description
and then have texbox where they can add a number and have that number of the same record inserted.
View 2 Replies
Jan 3, 2011
Hope this is the correct forum for this question. I am using VWD 2010 an have a web project and get the following error upon execution:
Parser Error Message: Unknown server tag 'custom:AjaxValidator'.
My code is as follows in the .cs file:
[Code]....
[Code]....
View 1 Replies
Oct 7, 2010
so here is the setup. I am building a page that has a listview, a datapager, and 3 datapagerfield (2 x NextPreviousPagerField, 1 x NumericPagerField), and a objectdatasource to tide all of this together.
It was all working fine until I put a breakpoint into the SelectMethod specified in the objectdatsource control. It seems like that for each datapagerfield control, it is calling the selectmethod and selectcount method. Hence, whenever a user paged, it calls the database 6 times instead of 2 (I don't have caching turned on atm). If I remove one datapagerfield, it will remove 2 calls.
Now this is build in asp.net 3.5 SP1 in VS2008. When I copied the same code files to a asp.net 4.0 VS2010 solution, it duplicate call seems to be gone.
Is this a bug in asp.net 3.5 SP1?
View 1 Replies
Mar 31, 2010
I'm having some difficulties registering a custom control from a class library in my webapplication's web.config file (or directly on a single page at all). These are the steps I've taken thus far:
1. I have a class library that generates a dll called "Core" and my webapplication has a reference to this "Core" assembly.
2. The Core class library contains a class called AjaxTable which is of namespace "Core.Presentation.DataViews".
3. AjaxTable extends System.Web.UI.Control.
4. I have added the following to my webapplication's web.config file.
<add assembly="Core" namespace="Core.Presentation.DataViews" tagPrefix="core" />
5. Since the previous didn't appear to work I tried the following variant:
<add assembly="Core" namespace="Core.Presentation.DataViews.AjaxTable" tagPrefix="core" />
It seems like I must be doing something small wrong or missing a step. Can anybody give me any advice? Thank you all in advance.
View 10 Replies
Oct 22, 2010
I have extended a gridview to add an additional header with following two hyperlink controls "Select All" and "Clear All". These will operate on checkboxes in the data rows of the grid. I hide the column headers as I only want to show one column with checkboxes and "Select/Clear All" links. Everything is working as expected. Now, I wanted to add a scrollbar to my grid control, I did add the scroll bar using div but what it does is, it includes the "Select All and Clear All" links aswell. I only need to add the scrollbar to datarows and not to the header.I am trying to extend my control to include hte scrollbar by adding div during Render function. But how will I determine or loop through header rows? How will i get the header row with hyperlinks that I created above?? In Render if I do this.HeaderRow, it gets the original column header and not the custom header.
View 1 Replies
Jun 14, 2010
Here is my code:
[Code]....
The problem is that BindHeaders is called multiple times. I was expecting it to fire only once since a very similar code I used to customize the GridView control to use our mapping utility on the headers works this way.
View 5 Replies
Jul 13, 2010
I have a very serious issue with my ASP.Net server when referencing (indirectly, it's a dependence of a referenced assembly) some third-party assembly.When I connect to the server I obtain this exception :
[Code]....
When I remove the assembly from the "bin" directory the site is accessible and works normally.So what might be the issue and how to get rid of this exception ?I'm using Visual Studio 2010 Professional.
View 1 Replies
Jan 6, 2010
I encounter a problem...error is Ajaxcontroltoolkit.dll is in bin folder, but still I get this follwoing error.Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. The module was expected to contain an assembly manifest.My code is (in .aspx file):
[code]...
View 1 Replies
Feb 23, 2011
I have developed an application using Visual Studio 2008. I have a hirerchical gridview and on every row i have a "Payment" button which actually inserts a payment entry in database. Here is the sample screen of that gridview so u have an idea what i am doing. Problem is that whenever user pressed the button of "PAYMENT" it is inserting multiple records in database..it should only fire once and i am failed to understand why its firing multiple times. Refer this link for my payment screen: [URL]
[Code]....
My code behind--------------------
[Code]....
View 3 Replies
Apr 4, 2010
I have a custom server control inheriting from CompositeControl. It consists of two RadioButtonlist controls that are rendered side by side in an html table. The number of ListItems in each RadioButtonList is not known until runtime. Depending on how many items each list contains, the RepeatColumns property of each list is set differently. To do this in the handler for the ItemDataBound event I need to get the count of ListItems in each RadioButtonList. How do I expose the Items.Count property of each internal RadioButtonList as a top-level property? I tried using a getter to return the count but this generates a compile-time error to the effect that the count cannot be assigned to--even though I have not created a setter.
Similarly, in the handler for the Submit event, I need to get the ClientID of each internal RadioButtonList to pass to a method that checks for data changes. How do I expose the ClientID of each component RadioButtonList as a top-level property?
I can of course index the Controls collection of the composite control to access the child control and read its properties--but that defeats the whole point of making a complex, independent custom server control.
View 1 Replies
Mar 22, 2011
I am trying to build a custom composite control, which allows me to add custom content to each child control. It's a similar concept to what you have with a GridView and TemplateColumn. The markup used to place the control on the page would end up being something like this:
[Code]....
I have the code below, which allows me to put that markup on the page without throwing any errors, and it renders all the correct HTML, except it doesn't render the contents of the ColumnTemplate. I have replaced the Render() code with a comment because it's quite long winded and doesn't add anything important here:
[Code]....
I have tried to follow examples on MSDN and other forums but I can't make this work. I think I'm missing the code to render the contents of the template, but I don't know how to hook that up.
View 1 Replies