|
The way the ASP.NET compilation works is pretty complex. In general it is not possible to use control/page references across web pages unless you are using @Reference[^].
The reason why referencing UserControl works sometimes and not some other times is because it is up to the discretion of ASP.NET build provider to build the control and page in the same assembly or in different assemblies. When they are in the same assembly things will work and when they are in different assemblies things will not. For pages the assembly names are generally of the form App_Web.If the compilation is in one go everything will be in the same assembly but on the client site probably the web site was already compiled and you added the user control later on. In any case it is better not to expect that user controls and assemblies will be in the same assembly.
There are 2 ways to solve this issue:
1. Declare an interface and put that interface in App_Code directory. The App_Code directory is referenced by all pages/controls automatically. Make the user control implement this interface. In the page access this interface.
2. Move to Web Application projects. The web application project compiles the cs code into a single assembly and you can reference controls from the pages and so on.
|
|
|
|
|
Thanks Rama. Option 1 seems to qualify, but my misfortune of not being able to recreate the error prevents me checking if I can do this. Option 2 is not an option at this point.
I'll look at using @Reference, this looks like it might 'coerce' the damn build provider to work properly. Is there any way I can delete all previous compilations on the client machine?
|
|
|
|
|
Brady Kelly wrote: Is there any way I can delete all previous compilations on the client machine?
There are two options again:
1. In the web.config file set the following setting:
<compilation debug="true" strict="false" explicit="true" tempDirectory="f:\development\temp\asp.net">
where tempDirectory is a directory of you choice. You can actually see the assemblies being built in a subfolder within that directory. Of course you can delete it whenever you want to.
2. The default location of compilation folder is "C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files". You will find a sub directory with the name of the web site root in that directory. You can delete files from that directory (you may need the web server to be shutdown)
|
|
|
|
|
When you deploy your website, do you provide a pre-compiled dll, or are you compiling dynamically in production?
|
|
|
|
|
Dynamically in production.
|
|
|
|
|
Don't know if this is any help at all, but..
We've encountered problems before where we had number of user controls, in different folders, where one control referenced another in a different folder (not really ideal...).
As the website compiles, it seems to work down through the directories, creating a dll for each, so, in some cases, we found that we got compilation errors when one control goes looking for another, but it has not been compiled yet.
|
|
|
|
|
Hi
I have two div in my web page and two radio button
I want initially both div will be invisible.When i am selecting one radio button i want one div will be visible and other will be invisible
I am using IE-7
please help me
|
|
|
|
|
u can use javascrpit function for this like:
function showdiv1()
{
document.getElementById('div1').style.display='block'; // to display
document.getElementById('div2').style.display='none'; // to hide
}
and make similar function for div2 and call them on selection of radiobutton.
|
|
|
|
|
I tried it but it is not working
|
|
|
|
|
try the ajax accordian pane thats the real fast way to do it in asp and also you can find it on google or codeplex for this third party dll and the functions working can be seen on asp.net/samples.If you want more then these are deeply described in wrox asp.net prof. buy the book.
byee,
cheers
|
|
|
|
|
set display:none of ur div where u have defiend ur div so that intially it is not visible.
There is nothing like which woultd not work try it and tell me exatcly what problem is coming.
|
|
|
|
|
You can do it just using JavaScript. Download jQuery 1.3.2[^] and test the code below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><br />
<html><br />
<head><br />
<title>DIV show / hide example</title><br />
<script type="text/javascript" src="jquery-1.3.2.min.js"></script><br />
<script type="text/javascript"><br />
$(document).ready(function() {<br />
$('#box_dv div').each(function() {<br />
$(this).hide();<br />
});<br />
$('#box_rdo input:radio').each(function() {<br />
$(this).click(function() {<br />
$('#box_dv div').hide();<br />
$('#' + $(this).attr('value')).show();<br />
});<br />
})<br />
});<br />
</script><br />
</head><br />
<body><br />
<div><br />
<div id="box_rdo"><br />
<input type="radio" id="r1" name="rdo" value="d1" /><label for="r1">DIV 1</label><br />
<input type="radio" id="r2" name="rdo" value="d2" /><label for="r2">DIV 2</label><br />
</div><br />
<br /><br />
<div id="box_dv"><br />
<div id="d1"><br />
<h1>DIV 1</h1><br />
This is the DIV 1 content!<br />
</div><br />
<br />
<div id="d2"><br />
<h1>DIV 2</h1><br />
This is the DIV 2 content!<br />
</div><br />
</div><br />
</div><br />
</body><br />
</html>
If you gonna use asp.net server controls, instead of <input type="radio"> and <div> use <asp:RadioButtonList> and <asp:Panel>... Handle the OnSelectedIndexChanged event of the radio button list to manipulate the visibility of the asp:panel's (div's).
modified on Monday, April 6, 2009 12:47 PM
|
|
|
|
|
The sample javascript is below.
function showdiv()
{
//To hide div
document.getElementById("DIV").style.display='none';
//To show div
document.getElementById("DIV").style.display='block';
}
....
....
....
....
.....
Use this in your code as per your requirement and this should definitely help you out.
|
|
|
|
|
Make both the divs runat='server' and assign them some ID
and write your code according to that.
e.g. on Page_Load if u want to both the divs invisible then :
div1.Visible= false;
div2.Visible= false;
Similarly you can write code according to the radio button selection.
Happy Coding,
Vivek Rathore
|
|
|
|
|
Hi,
Please help me with your ideas for the following
1.Does .net support for WEBDAV protocol?
2.Can I implement .net remoting using WEBDAV protocol?
Right now I implemented .net remoting using TCP/IP protocol.It is working fine.I need to change this to support the WEBDAV protocol.
Please help me.
|
|
|
|
|
Don't crosspost. See the answers in the C# forum...
|
|
|
|
|
Hi,
Public MasterDispDt As String
Public Sub ExFunction()
MasterDispDt = DtlsDs.Tables("DtlsTab").Rows(r).Item("DispDate").ToString
End Sub
TxtDispDate is a Textbox, Calender Selected value assigned to it.
Dim TDate As Date = CDate(Trim(txtDespDate.Text))
Dim MDate As Date = CDate(Trim(MasterDispDt))
If TDate < MDate Then
'Some Code
Endif
TxtDispDate I selected as '28-04-2009'
The above Code giving Error :
Error : Conversion from string "28-04-2009" to type 'Date' is not valid.
Pl. Help me out
Ramesh Sambari
|
|
|
|
|
this problem can be beacuase of date format.
try other formats like "MM/dd/yyyy" and apply break and check the result.
|
|
|
|
|
Hi,
When I run from Source Code, there is no problem. it is working fine. Even i run without debugging, that time also its fine. When I publish it to a folder and open , then the problem is coming.
Ramesh Sambari
|
|
|
|
|
While u r converting it to date format just specify the format like it is shortdate string or whatever u like, to all date controls and variable.
|
|
|
|
|
To convert a string to date, the date format should be MM/DD/YYYY OR MM/DD/YY.
The date "28-04-2009" is in the format dd-mm-yyyy.
This is the reason for the error.
Convert the string to correct format and your will get the result.
|
|
|
|
|
I used p/invoke but i need to add the reference of the dll in the project which is not possible the normal way i.e through Add reference in the solution explorer.
But wen i manually copy-paste it into the website cache(run->%windir%\Microsoft.Net\Framework or C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\Temporary ASP.NET Files), it works.
I want to avoid this manual copy-paste and want to map this dll into the project.
How do i do it?
Thanks in advance
|
|
|
|
|
Add the dll with "Add Existing item"-command within VS IDE. This will put the file to your ASP project.
|
|
|
|
|
i tried that too but the dll was not detected till i copy-pasted it in the temp asp folder iv mentioned earlier
|
|
|
|
|
If its used to give a tool reference to your project,why shouldnt you try browsing of dll by this:
1.go to toolbox,
2.right click on any of them,as suited to you,
3.click the choose items button which is used to inherits the com object,
4.browse the dll,
5.ok its done u can use it directly from toolbox now.
|
|
|
|