|
I'm writing a custom web component that allows you to explicitly specify the options in nested tags inside of the component's begin and end tags. My component is inheriting from System.Web.UI.WebControls.DropDownList so that it can read in the properties and item tags, and supports selecting an item by adding Selected to the items tag.
Unfortunately, when none of the items are selected, the component is being rendered with the first item selected anyway.
Anyone seen this happen before?
|
|
|
|
|
More information -
I created a minimum costom component for the drop down list with no additional properties, using only the following, other than the imports:
<code>Public Class cwcDropDownList
Inherits System.Web.UI.WebControls.DropDownList
Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
MyBase.Render(output)
End Sub
End Class
With the Render method my control renders fine, but using the RenderControl method causes the first option in the drop down list to be selected, even if it isn't in the controls definition in my the webpage. If it is selected then the control is rendered fine.
My webpage to test the custom drop down list contains:
<%@ Page Language="vb" AutoEventWireup="false" Inherits="cwcDropDownListTest.cwcDropDownListTest" CodeBehind="cwcDropDownListTest.aspx.vb" %>
<%@ Register TagPrefix="cwc" Namespace="cwcDropDownList" Assembly="cwcDropDownList" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>cwcDropDownListTest</TITLE>
<META content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<BODY>
<FORM runat="server">
<cwc:cwcDropDownList id="cwcDropDownList1" runat="server">
<ASP:LISTITEM Value="1" Text="one" />
<ASP:LISTITEM Value="2" Text="two" />
<ASP:LISTITEM Value="3" Text="three" />
</cwc:cwcDropDownList>
</FORM>
</BODY>
</HTML>
In my real custom control I can't use the MyBase.Render as that's not actually what I want my component to be. Instead I build my ComboBox component inside of a table, along with a number of other contols (a textbox, a listbox, an image, etc.), and then use the table.rendercontrol method to output the whole thing, and like the above simple drop down list, if you don't have a selected option, the render control "will appoint one for you".
Anyone know if there is a switch or something to turn off this behavior?
Thank you.
|
|
|
|
|
While digging in to this deeper I found out that inheriting from DropDownList caused this behavior, so I changed my custom object to ListBox, which doesn't automatically select an option for you.
|
|
|
|
|
Hi....
I have devoloped website in asp.net.
I just upload the project using ftp. Its works,
but i dont know how to upload sql database on server.
Can anybody please help me, Pls give me full details.
I used connectionstring in web.config which works for localhost.
but what connection string i should use for uploding on net.
|
|
|
|
|
Don't cross post and you will have a better chance of getting an anwser.
only two letters away from being an asset
|
|
|
|
|
Hello folks,
I have a question about a nasty thing or 'hack'?
type "codeproject" in google and you will get a result:
The Code Project - Free Source Code and TutorialsC++, C# and .NET (including VB.NET) articles, code snippets, discussions.
www.codeproject.com/ - 47k - 30 nov. 2006 - V pamäti - Podobné stránky
ASP.NET - www.codeproject.com/aspnet/
Advanced Search - www.codeproject.com/info/search.asp
C# - www.codeproject.com/index.asp?cat=3
MFC/C++ - www.codeproject.com/index.asp?cat=2
, so how must be the website content or menus created to reach a search result
in this shape (the small submenu under the main link)
thanx, tibiz
|
|
|
|
|
I can run the ASP website below and others from VS 2005 (not using IIS), but not from IIS without getting the error message below. I am running IIS on my desk PC which has XP Professional as an OS. Can anyone solve this mystery?
Thanks,
Art
-------------------------------------
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
A name was started with an invalid character. Error processing resource 'http://localhost/HelloWorld/default.aspx'. Line 1...
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
-^
Art
|
|
|
|
|
Here is the solution for my particular situation from on-line sources:
1)
Repair the IIS mappings so that the file name extensions for ASP.NET are properly associated:
To repair IIS mappings for ASP.NET running under XP, run the Aspnet_regiis.exe utlity. To do so, follow these steps: 1. Click Start, and then click Run.
a. Type cmd, and then click OK.
b. At the command prompt, type the following command, and then press ENTER:
"\WindowsFolder\Microsoft.NET\Framework\VersionNumber>\aspnet_regiis.exe" -i
Note Replace WindowsFolder with the name of the directory where the operating system is installed. Replace VersionNumber with the .NET Framework version installed on your computer.
2)
You need to select the appropriate ASP.NET version for your website. You can do so by following these steps using XP:
a. Go to Control Panal --> Administrative Tools --> IIS and right-click on your website's root virtual directory.
b. Click on Properties and go to the ASP.NET tab.
c. Select the appropriate version for your website (if you're running v5.x or older, you need ASP.NET v1.1; if you're running v6.x, you need ASP.NET v2.0).
|
|
|
|
|
I'm trying to write a simple javascript script that will enable the web page to send commands to my proxy server that I'm developing.
However it appears that both Firefox and IE block any attempt to use the XMLHttpRequest object to send web requests.
Is there ANY way I can get javascript to send ANY kind of information over the wire that my proxy server can intercept and provide custom services?
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
I don't completely understand, are you saying that IE and Firefox aren't letting you make Ajax calls?
The XMLHttpRequest does send web requests.
In addition what sort of proxy are you using?
Brad
Australian
By contacting your lawyer you negate the right to sue me.
|
|
|
|
|
Hi Brad,
I wrote a simple script that calls open( "GET", url, true ); and the Error Console in Firefox says, "Permission denied to call method XMHttpRequest.open"
The proxy is something I'm developing. It's going to be an intercepting proxy.
In the code below, the alert( "Request sent" ) never gets called:
var xmlhttp;
function loadPage( url )
{
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=state_Change;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
alert( "Request Sent" );
}
function state_Change()
{
alert("State Change" );
if (xmlhttp.readyState==4)
{
if (xmlhttp.status==200)
{
alert( "200 OK!" );
}
else
{
alert("Problem retrieving XML data");
}
}
}
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
Can you post all the javascript that relates to the request here?
Brad
Australian
By contacting your lawyer you negate the right to sue me.
|
|
|
|
|
I'm just beginning to learn javascript, so the code I'm trying to use is very simple: ( Thanks for your help ) It says "window.removed" below, but that's something CodeProject did. The real code says "onload"
<script language = "javascript" >
<!--
function myonload( )
{
loadDoc( "http://www.google.com" );
}
window.onload = myonload;
var xmlhttp;
function state_Change()
{
alert("State Change" );
if (xmlhttp.readyState==4)
{
if (xmlhttp.status==200)
{
alert( "200 OK!" );
}
else
{
alert("Problem retrieving XML data");
}
}
}
function loadDoc( url )
{
xmlhttp=new XMLHttpRequest();
xmlhttp.removed=state_Change;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
alert( "Request Sent" );
}
</script>
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
|
That's OK, thanks for your participation anyway.
I will take a look at that link and see if it can provide some clues.
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
Brad, your link DID provide the answer. It turns out that you're not allowed to make requests to domains other than the one that the page belongs to.
So because I was requesting Google, it gave the permission denied error.
Thanks!
--------------------------------
"All that is necessary for the forces of evil to win in the world is for enough good men to do nothing" -- Edmund Burke
|
|
|
|
|
That must be new to FF. No problem btw.
Thanks for asking the question, I could have seen myself making the same mistake.
BTW a quick hack to get past this is to build PHP/ASP application that will call the requested page, and have that uploaded to ur server.
Brad
Australian
By contacting your lawyer you negate the right to sue me.
|
|
|
|
|
Richie308 wrote: It turns out that you're not allowed to make requests to domains other than the one that the page belongs to.
Much as it pains me to admit it, apparently ATLAS provides a way around this.
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Richie308 wrote: It turns out that you're not allowed to make requests to domains other than the one that the page belongs to.
It would be a huge security hole otherwise. There are ways of getting around this for most browsers, but they require the user to explicitly allow the exception - so, they're more useful for intranet-type development.
|
|
|
|
|
Hello,
I was wondering 'if this is even possible' what is the "right" way to perform caching and state management within WebServices with ASP.Net 2.0? Or should you just use System.IO.MemoryStream?
My Scenario is:
UI will hit WebService lets say every 10 min and request data. However I don't want every user hitting the WebService to make a call to SQL.
Just need to be pointed in the right direction.
Thank you for the help.
RB
|
|
|
|
|
While State Management IS supported, it's generally not a recommended practice to implement it with web services due to scalability and practical reasons. Also you need to make sure that whatever is calling it also supports state management, typically via HTTP Cookies.
You implement it like this...
[WebMethod(EnableSession=true)]<br />
public Object DoSomething(){}
Then, providing you're deriving from System.Web.Services.WebService, you use Session same way you use it in ASP.NET web pages. However, if the caller doesn't support stateful webservice, then the Session values will be emptied with every call. If the caller is also a .NET app then enabling stateful Web Service support is entirely possible, write back and I'll post some code.
As for Caching, yes this is possible and recommended. You could do this manually using the Cache property of System.Web.Services.WebService (same way as ASP.NET web pages), or get the WebService to handle Caching itself like this...
[WebMethod(CacheDuration=600)]<br />
public Object DoSomething(){}
This will cache the output of the web service for 10 minutes (600 seconds). It's also intelligent enough to detect input parameters in the WebMethod and Cache different outputs depending on the input params. Although if lots a input params are used, you could end up caching lots of data and flooding the servers memory, so be careful.
|
|
|
|
|
Thank you very much for the information. Very helpful.
|
|
|
|
|
I am student of final year engineering student. I selected “SMS Website” as my project topic. In this I have to send Bulk SMS through website and provide other kind of services related to SMS.
Please tell me which steps I should follow.
Please send me some material or any kind of source code related to it.
I need your help.
Thank you!!!
Contact Me: ashish.0619@gmail.com
|
|
|
|
|
Hello mate.
I can tell you that there is an article somewhere in CP about this very topic. I can't remember its name however.
Basically you have to use an smpt mail server and send it to the phone companies mail server.
look for the article.
Brad
Australian
By contacting your lawyer you negate the right to sue me.
|
|
|
|
|