asp.net

How to generate unhandled exceptions in ASP.NET Web App?

I put some global error handling in place, but am having problems testing it by causing unhandled exceptions. Here's all I can think of at the moment. Please feel free to add to this list with more ways to trip unhanndled exceptions. 1) Dangerous form data - Entering characters such as < and > in a text box and trying to submit 2) ...

Using codeblocks within usercontrols

I tried using a codeblock syntax within a property sent to a web user control: <uc1:MyControl ID="MyControl1" runat="server" SomeProperty="<%= somevalue %>"/> The user control has the public property SomeProperty declared and also uses code block to display the property value: <p><% = SomeProperty %></p> The output on my page is un...

Get web user controls into visual studio toolbox

How can I drag a web user control (ascx file) into my page? It seems I can't put them into the toolbox. It seems I can drag them from project explorer into the page, but this only works in design mode. How can I make this work in source code view? ...

Could not load file or assembly App_Licenses

I was working normally but now i'm getting this error: Could not load file or assembly 'App_Licenses, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) I have researched for answers on the web but i cant find any specific h...

Display a "Yes / No" alert box in C# code behind

I am trying to display a "Yes / No" messagebox from codebehind in C#. I want to call an "AddRecord" procedure if the user clicks "Yes", and do nothing if the user clicks "No". Ideally, I want to use the code below, but from codebehind: OnClientClick = "return confirm('Are you sure you want to delete?');" I search on SO and google,...

SqlExpress mdf DB incompatibility

I used the ASP.NET (.NET4) default ASPNETDB.mdf database that gets created when using membership, in one of my sites. I then copied the site to the web server. Now it has been running for a while so there is content and comments. But I now need to make changes to the code that will also require extra fields in the db, so I copied the .md...

Trying to stop using asp concepts in asp.net...

Hello, I get the feeling I am still using asp type scripting techniques in the script below instead of proper asp.net scripting... If this is true, how do I do the below the proper .net way? <%@ Page Language="VB" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.SqlClient" %> <%@ Import Namespace="System.Tex...

display email of logged in user, aspnet forms authentication

hi, i'm using forms based authentication within my aspnet (c#) website. At the log in page i'm capturing username, password and email. the email addressed is stored within the membership table. now on a new page, i'd just like to display the users' email address so they update it as well as another boolean field. i've tried using a grid...

How do I stop my ObjectDataSource from binding twice?

This has been covered a couple of times, without a suitable answer: http://stackoverflow.com/questions/2641156/objectdatasource-firing-twice-or-on-its-own http://stackoverflow.com/questions/651293/objectdatasource-created-twice-when-control-is-changed I have created a custom paging data class that is used with an ObjectDataSource. In...

Advice on background processing in .net...

Hello, I have a webpage that reads data from an external source. It can take awhile to retrieve the data. I was wondering if someone could give me an idea on the best way to have this happen in the background. I would like the page to come up and display 'Processing' (or somthing like that) in the panel where the data will eventually...

ASP .NET Event Wire-Up for <input type="button"> tag (not asp:button or server link)

Here is what I want to do. Use this HTML line and have the ASP .NET server-side deal with the onclick event. I don't want to use nor do I want to use an anchor tag which would both allow me to capture the server-side successfully. I want to use this: <input type="button" id="submit" name="submit" value="See Your Results" onclick=""...

Persisting Dynamic Controls Over Postback

I have a datagrid that loads on page_load. In this instance I can't load the datagrid in page_init as the results of the datagrid are determined by a checkbox and the checkbox would always be set to true during page_init thanks to the viewstate not being loaded. I have an OnItemDataBound event on the datagrid that dynamically creates...

Forms authentication not forgetting me

I am using an ASP Login control to authenticate users, however even if the user doesn't check the 'Remember Me' check box the user will not be forgotten, even if they close their browser, shutdown their PC and open it up again. Authentication is: <authentication mode="Forms"> <forms name=".ASPXFORMSAUTH" loginUrl="~/Default.aspx" tim...

Dynamic Control not showing on post back

I have a wizard control that I am adding dynamic steps to that will not show the step on the first refresh. I have to click another button for it to show. My Dynamic creations are inside the onInit so I am not sure why this is happening. Please let me know what I am doing wrong. protected override void OnInit(EventArgs e) { ...

How can I expose a repeater's templates from another control that contains the repeater?

If I have a custom user control (say, MyCustomControl.ascx) which contains a number of other controls including a repeater, is there any way to expose that repeater's templates as templates for MyCustomControl? For example, I would want to be able to do this: <uc:MyCustomControl ID="MyCustomControl1" runat="server"> <ChildRepeaterH...

abstraction and interface explanation

could some body explain me abstraction and interface in asp.net, C# by taking an apprpriate example...pleasse i am not understanding it for long ...

ASP.NET DataGrid, is it possible to disable sorting on specific columns?

Hi, is it possible to disable sorting on specific columns? 5 out of 7 columns have to be sortable, two not sortable. The columns are created dynamically in code behind, so I think doing this with mark up is out of the question. When I say disabled, I'm hoping that the underline wont show on the column header when you mouse over it. An...

How can I redirect an asp.net mvc2 page

I'm looking to take data posted to a form, process it and then make a redirect to a third-party website with both GET data AND POST data. I understand that Response.Redirect() is not the way to go about this - what is though? I dont want to make the original form submit to the third party provider, I have some processing to do on thei...

Captcha using jQuery

Can I got some good example sites with source code of jQuery with ASP.NET webforms using ajax.Most examples I have come across are in php ...

Prevent wrapping <span> tags for ASP.NET server control

I am writing various ASP.NET Server controls and am needing to remove the tags that wrap my control by default. I am aware that you can change the tag to a different tag (as in this question, http://stackoverflow.com/questions/1084311/how-do-i-change-the-render-behavior-of-my-custom-control-from-being-a-span) but how can you prevent it?...