|
I'm trying to instantiate a class by name.
The class is in my projects namespace and located in a file in the App_Code folder.
Basically I am calling :
Type tip = Type.GetType("PortalModuleControl");
where PortalModuleControl is the mentioned class;
But tip returns null.
Isn't Type.GetType supposed to look for the definition of the class in the current assembly?
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
Yes what you are doing is not right...
Here is a the rith way:
<br />
Type type = Type.GetType("MyNameSpace.TheWholeThing.MyClassName, MyNameSpace");<br />
MyAssemblyName issually is the same as the namespace, for instance but not always:
<br />
namespace TQU.Demo{<br />
public class Test2{<br />
<br />
}<br />
}<br />
<br />
namespace TestingTypes<br />
{<br />
class Class1<br />
{<br />
<br />
<br />
[STAThread]<br />
static void Main(string[] args)<br />
{<br />
Type type = Type.GetType("TQU.Demo.Test2, TestingTypes");<br />
}<br />
}<br />
}<br />
Greetings
FDM
|
|
|
|
|
Type type = Type.GetType("myNameSpace.PortalModuleControl, myNameSpace");
doesn't work either.
I have only one namespace in my application.
I'm dealing with an ASP.NET application. Are there some restrictions regarding this?
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
Type type = Type.GetType("myNameSpace.PortalModuleControl, MyAssemblyName");
Can you tell me if your namespace is the same as your assembly name.
What's your assembly name?
|
|
|
|
|
Hmm, I'm guessing it is. My Asp.Net application is running using the ASP.NET Development server which from my understanding acts like IIS and precompiles the code while running. I tried deploying the application but there's no DLL in the bin folder
Anyway, from my understanding the assembly doesn't need to be specified when you use Type.GetType . Only when you use Assembly.GetType
Am I wrong?
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
Buddy u got all wrong.
If you don't see the dll in your bin directory it is because either you did not compile it
or you are getting a compilation error.
ASP.NET does not compile the ASP.NET code in runtime, .NET compiles IL in runtime.
If you want to see the your assembly name right click the project and click properties, there are some tabs there one of them will have the assembly name.
Greetings
|
|
|
|
|
Felipe Dalorzo wrote: If you don't see the dll in your bin directory it is because either you did not compile it
or you are getting a compilation error.
I wish that was it. Unfortunately something goes wrong. Meaning the project builds, it runs, but when I publish it, the directory that I choose to publish to is empty. I have tried all options in the publish dialog and the result is the same.
Aparently others are experiencing this, too. No I just need to have a solution that aparently others didn't find
Felipe Dalorzo wrote: ASP.NET does not compile the ASP.NET code in runtime
The App_Code folder and its special status in a web application allows you to store classes that will automatically be compiled at run time.
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
Hi all
From last 30 days i have been searching for a tool or any mechanism through which I could print reports in my asp.net 1.1 application in a proper format.
I tried Crystal reports but in this one can print report only by exporting them into pdf .. and obviously its not a solution.
what I want is if I print a report (say have 1000 records) then the data grid header should be shown on all pages, instead of only on first page.
|
|
|
|
|
cdotpal wrote: one can print report only by exporting them into pdf .. and obviously its not a solution
What do you mean by this? Is it that you don't want to do any conversion before your reports are printable?
cdotpal wrote: then the data grid header should be shown on all pages, instead of only on first page.
This is possible without getting any reporting tools. If you just want people to be able to print out data from your web application, then look at this[^]. You can modify your data grid a bit and add some styles to get the header to print on every page.
Logifusion[^]
|
|
|
|
|
thanks dustin, I havent got the solution yet but thanks for the useful information.
|
|
|
|
|
Try MS reporting services which can export in PDF, Excel, xml etc.....
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|
|
I'm trying to play around with Lightbox (http://www.huddletogether.com/projects/lightbox2/). Anyway, I'm working on an existing site with a single master page. I attempt to add the following to my page:
<script type="text/javascript" src="~/js/prototype.js" runat="server"></script>
<script type="text/javascript" src="~/js/scriptaculous.js?load=effects" runat="server"></script>
<script type="text/javascript" src="~/js/lightbox.js" runat="server"></script>
Now, I get hundreds of build errors. If I take these links back out, they go away. I've found that it is because of the runat=server attribute (because if I take it out and use the "../" syntax, things work again). Now, I'd like to be able to reference these scripts using the "~/" syntax that is common in ASP.NET, but I can't figure out how to make that happen without build errors. Any ideas? It's not a particularly big deal, but I think it's important for me to understand WHY it doesn't work.
Thanks,
Will
|
|
|
|
|
client side javascript cannot run on a web server.
In order for the web page to be displayed the files need to be downloaded as well and the location of these files on your web server is either relative (../) or full (http://www.whatever.com/foldername/filename.js). As a web page downloads, copies of the support files - js, css, images etc are also sent therefore these files are now copied to the client.
modified 1-Aug-19 21:02pm.
|
|
|
|
|
Turns out that I had a misconception about how to handle this. I did need to use the "~/" trick for accessing the script file, but it turns out that you can use Page.ResolveUrl to use it without making the <script> block runat=server. My main issue was that when I made it runat=server that the runtime was attempting to parse the javascript file.
|
|
|
|
|
I have a three tiered asp.net application and in my Student_Results class - I have my properties set up like this:
Public Property Enumerator()
Get
Return m_intenumerator
End Get
Set(ByVal Value)
m_intenumerator = Value
End Set
End Property
I have a text box where the intenumerator is taken from on another form a popup: the value is saved to the session variable and then the save function of the class uses a stored procedure to send the info into the table of the sql database. The field in the database is set up to accept nulls but I have an error hitting in the property as it will not accept the null value.
I have this on my popup form:
If Session("Marks") Is "" Then
m_objStudent_Results.Enumerator = System.Convert.DBNull
Else
m_objStudent_Results.Enumerator = CType(Session("Marks"), Integer)
End If
How do I deal with this problem - the text box being filled in is not mandatory - the end user can either put something there or not and if not I want the value of null set back the table.
thx, Tammy
|
|
|
|
|
Tammy, you need to test your session variable for empty string AND null... believe me when I say that I learned my lesson the hard way
Im comfortable with C#, so interpret this to VB syntax:
if (Session("Marks") != null && Session("Marks") != "")
{
//execute some instruction
}
else
{
//...now get the idea!
}
Nila Fridley
|
|
|
|
|
I'm embarrassed to say it but I can't spell to save my life some day's. Being a programmer this makes me look like a fool and even worse when I'm working with a web application. My boss has come to me and has asked me to find a solution to this issue of mine. I'm using VS 2005 Pro with the Adobe CS suit for misc. web and graphics features, plug-ins. Does anyone have an add-ins for VS 2005 for spelling within strings? My error messages, text within XSLT, and just in general.
I'm not having a bad hair day but a bad spelling day!
|
|
|
|
|
|
, it the strings and bodies of text. I get in a hurry and that all it takes. Thanks works great.
|
|
|
|
|
I've begun my GuestBook program's testing. It is a "WebSite" in terms of VS-2005. Home the program goes ok. But when I am using it through hosting, it fails. Maybe, the Internet needs something.
My website is http://hilsoft.qsh.ru
When enter, press above on LINKS
When will appear http://hilsoft.qsh.ru/Links.aspx - there is an inscription-link below "Guest Book Small". Go there, and you will see my problem. Home the new record is building ok. The texts of my program I am ready to send willingly. Please, help!
HilSoft
|
|
|
|
|
I have created a win32 DLL for my Web Application. I am using "DllImport( )" for importing the DLL file from the root directory of the Web Application. It works fine in the local machine ("localhost"). But when ever i Deploy my web application on web including the DLL and try to run the specified webform, then "Unable to load Dll" error message is returned back by the web server.
Can any one suggest anyting?
SMI
|
|
|
|
|
it could be path which when you deploy not recognised by app... or your DLL call another DLL method which is not there on deployment server.
sorry if its not the case.
Nav.
|
|
|
|
|
I have a free website that allows alumni of my high school to sign up and share information. It's like classmates.com, except it's free to alumni of my school (http://www.daviehighalumni.com[^] if you're interested).
There is one user who likes to cause problems by posting offensive messages on my message board, annoy other users, etc. I can easily block this user from signing in, but have no restrictions on creating new accounts, so they can easily create a new account and continue their behaviour.
I could try requiring e-mail authentication before a new account can be used, but this person could impersonate another alumni who doesn't yet have an account. I can't base it on IP address because they change often. I can't base it on name or e-mail address because a person can easily use a different name or create a new e-mail address.
Here's my last attempt to block this person: I put a tag on their profile so that when they logged in, I set a cookie on their computer. From then on, if I see this cookie, I don't let them log on or create new accounts. I thought this would keep them out for sure, but it hasn't worked as they apparently know how to delete cookies or are going to different computers.
So, does anyone have any ideas on blocking a user from accessing a web site when the web site is free and allows users to create accounts?
Barry Etter
|
|
|
|
|
you can set a message/post approve system which control by one or more site admins
Nav.
|
|
|
|
|
Yeah, I was gonna say the same thing too. He can also create a dictionary of offensive words/phrases, and create a utility of some kind that checks user inputs against that list as a pre-approval process. Just a suggestion!
Nila Fridley
|
|
|
|