asp.net

How to create a database and populate it during setup

I would like to find a way to create and populate a database during asp.net setup. So, what I'm willing to do is: Create the database during the setup Populate the database with some initial data (country codes or something like that) Create the appropriate connection string in the configuration file I'm using .NET 3.5 and Visual St...

Show asterisk in validation control but show error message in summary.

I'd like a way to both show an asterisk by an invalid field and show a verbose message in a validation summary. However, setting Display to "NONE" in the validation control suppresses any message that would appear next to the field to validate. Is there a way to get this kind of hybrid function? ...

IIS 404 Custom Error not working as expected

I'm working on IIS6, ASP.NET, VS2008. The web site uses a custom error handler to catch 404 errors and serve an alternate page. When presented with an url of the form: http://srv/crimson/articles/index Everything works perfectly. But an url of the form: http://srv/crimson/blog.aspx Where blog.aspx does not exist, fails with the follo...

How do I access a control in the HeaderTemplate of my GridView

I want to have a DropDownList in the header of my GridView. In My codebehind I can't seem to access it. Here is the HeaderTemplate: <asp:TemplateField SortExpression="EXCEPTION_TYPE"> <HeaderTemplate> <asp:Label ID="TypeId" runat="server" Text="Type" ></asp:Label> <asp:DropDownList ID="TypeFilter" runat="server" Auto...

Passing session data between ASP.NET Applications

We have several ASP.NET applications deployed to a few servers. Is there a standard way to reuse session data or some other method to not require users to log in to the next application when moving from application to application if they've already authenticated? I'm hoping there's a best practices way of doing this that you guys know ab...

Reset scroll position after Async postback - ASP.NET

What is the best way to reset the scroll position to the top of page after the an asynchronous postback? The asynchronous postback is initiated from a ASP.NET GridView CommandField column and the ASP.NET update panel Update method is called in the GridView OnRowCommand. My current application is an ASP.NET 3.5 web site. EDIT: I ha...

Resources for taking an existing design template and putting it into a masterpage?

I am not a designer, so I took a design template from http://www.opendesigns.org/ and was successful in implementing the design in one page, but when I tried to put it into a masterpage, it came out funny looking, so I was curious if there were any resources/tutorials on taking design templates and putting them in masterpages. ...

Authentication options in a scenario, where a silverlight application is calling a self-hosted wcf service.

Our system consists of a self-hosted (non-IIS) WCF service and an Asp.net website which hosts a Silverlight application. The application is supposed to do pretty much everything, the website is just a "shell" in this case. We have a hard time figuring out how to solve user authentication securely. To my knowledge, Silverlight can not h...

ListView edit command button won't respond

I've got a LinkButton set up in the ItemTemplate of a ListView. It displays fine, but it's not doing anything when clicked. It's supposed to be a simple Edit button, but it's driving my crazy. Here's the button: <asp:LinkButton ID="EditLinkButton" runat="server" CommandName="Edit" Text="Edit" /> and here's the code-behind: Protected ...

Default model binder and complex types that include a list

Hi All I'm using RC1 of ASP.NET MVC. I'm trying to extend Phil Haack's model binding example. I'm trying to use the default model binder to bind the following object: public class ListOfProducts { public int Id { get; set; } public string Title{ get; set; } List<Product> Items { get; set; } } public class Product { pu...

Possible to have a inner control on a custom server control?

I would like to be able to do something like: <ui:Tab Title="A nice title"> <TabTemplate> <asp:Literal runat="server" ID="SetMe">With Text or Something</asp:Literal> </TabTemplate> </ui:Tab> but also be able to do: <ui:Tab Title="A nice title"> <TabTemplate> <asp:DataList runat="server" ID="BindMe"></asp:DataList> </T...

Is there a performance issue when using inline SQL statements rather then using a DAL design?

I made a fairly large social network type website and used nothing but inline SQL Statements to access the database (I was new to the language so back off!) Are there any performance issues when doing it this way as opposed to using a massive XSD DataSet file to handle all the queries? Or is this just bad design? Thanks! ...

Benefits of using data source controls for binding

hi I've started learning data source controls To my understanding, the only benefits of using data source controls instead of using regular data binding are the following: you don’t have to write data access logic (thus you don’t have to create SqlCommand, SqlConnection etc, and you also don’t have to create Datareader or DataSet) y...

Using JQuery in asp.net Masterpage

JQuery is not being able to identify tags when I use in the Master Page. The following code: <script type="text/javascript"> $("body").append('<div id="test"><p>Hello</p></div>'); </script> Works fine in normal pages, but when the body is in the master page and I put this same code in the Master page - nothing happens! How can I...

If you use a declaritive datasource can you access the dataobject programatically?

I'm using asp.net 2.0. I am using declarative datasources. For some things in the code behind I want access to the object returned by Foo.Bar (In the following example). the system is caching it so I should be able to acces that version instead of having to re-call Foo.Bar(). How do I do this? <asp:ObjectDataSource ID="MyLuckDataSource1...

JQuery ajaxStart event not being captured in ASP.net AJAX

I have an asp.net page with a save button within an updatepanel and contenttemplate. The save works nicely, but I am trying to add a "wait" gif while the save is happening using JQuery, but the ajaxStart event is not firing. I put a simple catch shown below: $(document).ajaxStart(function(){ alert('starting'); ...

Why does the Update Panel do a full post back for custom control?

I have a rather complex custom control - the custom control has a couple of update panels in it. I am trying to use the control like this inside of an update panel: <asp:UpdatePanel ID="up1" runat="server"> <ContentTemplate> <asp:Button ID="btn1" runat="server" Text="Sample Button" />&nbsp;&nbsp;<asp:Label ID="lblTime" run...

IHTTPModule to switch between HTTP and HTTPS in ASP.NET

I'm working on a web site which contains sections that need to be secured by SSL. I have the site configured so that it runs fine when it's always in SSL, I see the SSL padlock in IE7/IE8/FireFox/Safari/Chrome To implement the SSL switching, I created a class that implemented IHTTPModule and wired up HTTPApplication.PreRequestHandlerE...

IIS virtual directory, root path deployment ASP.NET

I need a few pointers about how to make a project structure in order to migrate from VSS to SVN, as it stands now it has: Dev trunk-------------------------------->http://localhost/myapp Test environment branch ---------->http://test.myapp.com Production environment branch-->http://www.myapp.com The deal here are th...

Sorting a gridview when databinding a collection or list of objects

I am attemping to have my gridview be: bound by a List in code-behind. I am using my own custom BOL. no datasource object on the html page sortable on each column that I choose. The SortExpressions are all set correctly. The resulting error message: The GridView 'myGridView' fired event Sorting which wasn't handled. How can I have...