asp.net

Custom System.Collections.Generic.Contains For Testing Custom Object

How can I rewrite or is there a way to writing my own custom function that simulates the Custom System.Collections.Generic.Contains but only factors in certain Public Properties of a Custom Object? For example if I have a custom Object with Properties Name and ID, I would like my Unique Value List to contain all the DISTINCT Names. The ...

How to determine type of dynamically loaded usercontrol?

I have an application the will load usercontrols dynamically depending on the user. You will see in the example below that I am casting each user control via switch/case statements. Is there a better way to do this? Reflection? (I must be able to add an event handler Bind in each control.) override protected void OnInit(EventArgs e) {...

ASP.NET: Casting XPath to bool - Possible?

Greetings! I have an XML value that I'd like to use as a boolean value to toggle the visibility of a Panel. I have something like this: <asp:FormView id="MyFormView" runat="server" DataSourceID="MyXmlDataSource"> <ItemTemplate> <!-- some stuff --> <asp:Panel id="MyPanel" runat="server" Visible='<%# (bool)XPath("Men...

How can I trick MVC into rendering links based on a different virtual path?

I'm running a bunch of apps on discountasp.net with the subdomain addon. Since with shared hosting I can't have multiple IIS sites, I've also written an HTTP module that allows sites in subfolders to operate as if they are running in the root directory. So for example, instead of hosting my blog at dandoes.net/blog, I can host it at blog...

How to convert line breaks in input form in ASP.NET?

How do you usually convert line breaks in a form textbox or input=text element to html line breaks? Thanks Edit: Is it always \r\n with all browsers? ...

Error: Webform_SaveScrollPositionSubmit is not defined

Hi all, I am facing this "Webform_SaveScrollPositionSubmit is not defined" client side error while i click on link button inside the datalist contol and its event does not fire. can any one tell me what is the reason for this and how to resolve it. ...

Session management for a load balanced website

We are currently using database to maintain state information (in a separate table) for the user. We fetch that information from the database every time user access the application (sends request) and update it in the database back after processing the request. This has worked very well for us in many of our projects and is very easy to...

Accessing ASP.Net WebService using XMLHttpRequest and SOAP

I have a webService hosted at http://recpushdata.cyndigo.com/jobs.asmx. I would like to call this webservice using XMLHttpRequest and SOAP. The thing why I would like to do this is that I have hosted a client application which is accessing the webservice perfectly, but when client is trying to access the same webservice its giving some e...

Setting GridView header text to wrap as directed.

I have a GridView that has columns such as: | A | B C | D E / F | I want these to be wrapped in a particular way - that is, I do not want to leave it up to the browser to work out whether to wrap or not depending on the column width. So in the above example I may want the following: | A | B | D ...

In ASP.NET MVC how can use I Url.Content() from code?

I'm trying to write a custom helper method that will output an image tag but I need to access something like Url.Content() to get a proper URL for the current context. Is there any easy way to do something like this? ...

How to get started in creating a Wikibot like component in asp.net?

...wikibot, the Joomla! plugin helps to make auto-wikipedia links for the website words. How to make such a component in asp.net? ...

ASP.NET event order during postback or initial request

Could I get some confirmations from the community that I'm not going mad, and that the life cycle of a page during post back is in deed in a different order to when the page is initally requested. If this is the case pointers towards references/articles outlining the order would be greatly appreciated. (A postback equivalent of the pag...

How should I structure a simple ASP.NET MVC app?

I've been reading a few things about ASP.NET MVC, SOLID and so on, and I am trying to figure out a simple "recipe" for small-to-medium ASP.NET MVC apps that would put these concepts together; the issue that I am most concerned with is ending up with controllers that are too complex and being like code-behind files in webforms, with all t...

"Unknown web method" error after Server.Transfer

I use System.Web.Services.WebMethodAttribute to make a public static method of an ASP.NET page callable from a client-side script: test.aspx.cs [System.Web.Services.WebMethod] public static string GetResult() { return "result"; } test.aspx <asp:ScriptManager ID="sm" runat="server" EnablePageMethods="true" /> <script type="text/...

Entity Framework, Compiled Queries and IIS

I am using Entity Framework with my website. To improve performance, I have started to use compiled queries wherever I can, either directly with CompiledQuery.Compile or using ESQL. The performance now is fantastic, that's it, once the queries are compiled. Compiling them takes quite a bit of time on some pages apparently, so the first...

Invalid URI for Localhost

We have a website/webservice running on one of our servers. We hit that webservice once a day with a scheduled .bat scipt. Just recently the scheduled task started to fail. The log shows "Invalid URI: The hostname could not be parsed." When we're logged into the server we can reach the website through http://localhost/website, but get ...

Post large data in C#

I have the following scenario Have a web browser control which uses the Navigate method to call a web page. I have the need to post a large number of elements via FORM POST. The number of elements can be either 40-100 elements. Is it advisable to encode this and send it via the the Navigate method? Does one normally do this via FORM...

Is AcquireRequestState suppose to fire for ASP.NET URL Routing for IIS7?

Coming from this question here, http://stackoverflow.com/questions/218057/httpcontextcurrentsession-is-null-when-routing-requests, I also noticed that when routing, all my sessions were null when I have custom IHttpHandlers access it. I used the answer from that question to fix it. Which is basically to add System.Web.SessionState.Sess...

Subversion and using IIS for ASP.NET development

Hi, I'm a total newbie to SVN and haven't been able to find an answer for the following situation. I have an ASP .NET 2.0 web app that I am developing. I am using my local IIS as the development web server (i.e. not the Visual Studio web development server). My development environment is VS2005, Vista, IIS7, TortoiseSVN / AnkhSVN. Visu...

How do I get the GridView Control to use post backs for paging inside an update panel?

I have a GridView Control that for other functionality has to be inside an update panel. The site is using the Ajax Control Toolkit and the "EnableSortingAndPagingCallbacks" property on the Grid is set to false. However, when I execute a paging call it is still doing it as a callback instead of a postback. How do I fix this and get the p...