asp.net

Why do WebControl events have the prefix of "On"?

I'm trying to fully understand the WebForm event model (not the page lifecycle, but how the events are wired up when specified declaratively in the .aspx or .ascx files. Take the Button control for example. It has a Click event that you can wire to in the code-behind, but it has an "OnClick" event in the .aspx/.ascx file. I used the .N...

adding controls dependent on sql table??

Hello all I'm working on a little project where I'm adding controls to a page based on a SQL table of questions, this table will grow overtime. I just wanted to share the code and see if there was any better way or if any of the experts could chime in and give me any insight on future problems. Here is the code: protected void P...

ASP.NET LoginStatus Control - Overriding the ReturnURL in generated QueryString

I have a website that uses the ASP.NET Login Controls and Forms Authentication. I've placed the asp:LoginStatus control inside another Web User Control that manages the display of the Header portion of my site. The issue I have is that the ReturnURL presented by the LoginStatus control references the path to the Header Control, not the...

How do you use .pem files to authenticate a WCF request?

I'm trying to utilize the Amazon Product Advertising API. They provided me with a .wsdl file which I consumed and generated wrapper classes for via Visual Studio 2008's "Add Service Reference" option. This wrapper class works just fine as is and I've been successfully sending requests and receiving responses from Amazon. However, they...

Can I add something to the user session in a custom MembershipProvider?

I am implementing a custom MembershipProvider in order to pass the login details to a custom business object that we use in several other places in our company. But once we have authenticated I'd like to save this initialized business object in the session to be used later in other pages. Let me give an example. public override bool Val...

ASP.NET MVC Helper Extension Method not rendering text as a control

Tried to create this Extension method. Works except that the helper is rendering text, not the control to the View when the page renders: I included using System.Web.Mvc.Html; at the top of my helper class that contains this extension method so that it would understand helper.RadioButton. public static string WriteTestControlToScreen(...

Updating Active Directory from Web Application Error

I am receiving an error a web based application that allows corporate intranet users to update their active directory details (phone numbers, etc). The web application is hosted on IIS6 running Windows Server 2003 (SP1). The IIS website is using NTLM Authentication and the website has integrated security enabled. The IIS application po...

How can I have an button call a server function and then update an update panel?

Hi, I have this layout: <div runat="server" OnClick="ChangeText()" id="button">Ok</div> <asp:UpdatePanel id="updater" runat="server"> <ContentTemplate> <div id="text">Hello</div> </ContentTemplate> </asp:UpdatePanel> I would like to have it so that when the button is clicked, the function ChangeText() gets called on t...

how to export a grid view in to excel?

hi i am developing an application where i am using a grid to dispaly data and adding a dynamic datatable as the header of the gridview and iam using the following code to export the grid view into excel but i am unable get the datatable which was added dynamically to the grid into the excel. the code i am using is: Response.AddHeade...

Accessing Request.Cookies from a Controller Constructor

Hi folks, I am using the UserData Property of the FormsAuthenticationTicket to store some userspecific information. I have a HelperClass which deserializes this UserData into a custom Object for strongly-typed access. I have my controller setup as follows public class SomeController : Controller { private CookieData _cookieData; ...

Problems with asp:Button OnClick event...

Hi, Here is my button <asp:Button ID="myButton" Text="Click Me" OnClick="doSomething(10)" runat="server" /> Here is the server function public void doSomething(int num) { int someOtherNum = 10 + num; } When I try to compile the code I get the error "Method Name Expected" for the line: <asp:Button ID="myButton" Text="Click Me"...

how to add encoding information to the response stream ?

hi i have following piece of code: public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/rtf; charset=UTF-8"; context.Response.Charset = "UTF-8"; context.Response.ContentEncoding = System.Text.Encoding.UTF8; context.Response.AddHeader("Content-disposition", "attachment;filename=lista_o...

How to retrieve an Image from MS SQL Server to bind in Gridview ASP.NET by using LINQ to SQL?

I have a binary file which stores in the customerPicture column that has Image as a datatype in the CUSTOMERs table. I have saved an image by using this line of code in LINQ to SQL. Dim db = new MyCompanyDataContext Dim newCus = new CUSTOMERs Dim filebyte As Byte() = fileUploader.FileBytes Dim fileBinary As New System.Data.Linq.Binary(...

Hide header and footer while printing a webcontrol using ASP.NET

How can I hide the header like 'Page 1 of 1' and footer (url) when printing a webcontol in ASP.NET? I currently doing by opening a new page on Print button click ande in it protected void Page_Load(object sender, EventArgs e) { if( null != Session["Control"] ) { Control ctrl = ( Control )Session["Control"]; Pri...

Asp.net Time Input Control Suggestions

Can anyone recommend a Time Input control for an asp.net web application? It should be able to handle the following items Am/Pm 24 Hour client side validation client side completion (if you start the hour with a 3 then jump to minute) one textbox (not separate textboxes for hours and minutes, or drop downs) ability to actually type ...

ASP.NET Show StyleSheet In Logon Page

I want to use my site style sheet on the logon page. I have the following in my web.Config but I'm not allowed at the css page unless I'm logged in <location> <system.web> <authorization> <deny users="?" /> <allow users="*" /> </authorization> </system.web> </location> <location path="~/App_Th...

Compiling/Embedding ASCX templated UserControls for reuse in multiple web applications

Hi, I'm onto a real head scratcher here ... and it appears to be one of the more frustrating topics of ASP.NET. I've got an assembly that implements a-lot of custom Linq stuff, which at it's core has zero web functionality. I have an additional assembly that extends this assembly with web specific behaviour. The web specific behaviou...

Will running aspnet_regiis.exe -ir create any problems?

Hi there. I've asked a question about changing the version of .Net sites in the IIS. If it affects classic asp sites etc (See Does asp.net setting affect classic asp (IIS 6 settings)) And that seems fine. So my follow-up question is, will running this command get me fired? What it does is changing the default value (and all existing?) of...

Can you create sub-applications within applications in IIS/ASP.Net

We have a global application (well out of my control) that runs a lot of sites. I'd like to create a new application (as I cant extend etc) within a folder so it could be accessed as follows. http://www.domain.com/ < Global App http://www.domain.com/newapp < New App Is this actually possible or just a pipe dream; I'm aware that its p...

How to get parent GridView's data-bound value

<asp:GridView DataSource="Reports"> <ItemTemplate> <asp:TextBox Text='<%# Bind("ReportId") %>' <asp:Repeater DataSource="Something that is different than the GridView's DS"> <a href='<%# Bind("ReportId", "reports.aspx?report={0}") %>'/> </asp:Repeater> </ItemTemplate> </asp:GridView> I know t...