asp.net

How to change CSS class of a HTML page element using ASP.NET?

I have several <li> elements with different id's on ASP.NET page: <li id="li1" class="class1"> <li id="li2" class="class1"> <li id="li3" class="class1"> and can change their class using JavaScript like this: li1.className="class2" But is there a way to change <li> element class using ASP.NET? It could be something like: WebControl...

Which search technology to use with ASP.NET?

What's your preferred method of providing a search facility on a website? Currently I prefer to use Lucene.net over Indexing Service / SQL Server full-text search (as there's nothing to set up server-side), but what other ways are being used out there? ...

ASP Nested Tags in a Custom User Control

I'm just getting started with Custom User Controls in c# and I'm wondering if there is any examples out there of how to write one which accepts nested tags. For example, when you create an "asp:repeater" you can add a nested tag for "itemtemplate". Any help appeciated! Cheers ...

Securing a Web Service

I have a Web Service (ASMX) with a few Web methods on our production Web server. On a separate internal Web server (which isn't publicly exposed) I have another Web site that will use the ASMX's public web methods. What are some of the best ways to secure the Web service such that only the internal Web server can access the Web Service...

Separating Web Applications into multiple projects

I have a web application that is becoming rather large. I want to separate it into smaller more logical projects, but the smaller projects are still going to need to access some of the classes in the app_code of the main project. What are some good methods to accomplish this? ...

Read in an XML String with Namespaces for Use in an XSL Transformation

In an ASP.NET 2.0 website, I have a string representing some well-formed XML. I am currently creating an XmlDocument object with it and running an XSL transformation for display in a Web form. Everything was operating fine until the XML input started to contain namespaces. How can I read in this string and allow namespaces? I've incl...

Is there a way to comment out markup in an .ASPX page?

Is there a way to comment out markup in an .ASPX page so that it isnt delivered to the client? I have tried the standard comments but this just gets delivered as a comment and doesn't prevent the control from rendering. Any suggestions would help ...

Is there a good way of securing an ASP.Net web service call made via Javascript on the click event handler of an HTML button?

The purpose of using a Javascript proxy for the Web Service using a service reference with Script Manager is to avoid a page load. If the information being retrieved is potentially sensitive, is there a way to secure this web service call other than using SSL? ...

Reading XML with an "&" into C# XMLDocument Object

I have inherited a poorly written web application that seems to have errors when it tries to read in an xml document stored in the database that has an "&" in it. For example there will be a tag with the contents: "Prepaid & Charge". Is there some secret simple thing to do to have it not get an error parsing that character, or am I mis...

I'm getting a strange unhandled exception from my asp.net application - Validation of viewstate MAC failed

I don't know if anyone has seen this issue before but I'm just stumped. Here's the unhandled exception message that my error page is capturing. Error Message: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validatio...

Implementing User-Controlled Style Changes in ASP.NET

Ok, so we have clients and those clients get to customize their web facing page. One option we are giving them is to be able to change the color of a graphic (it's like a framish-looking bar) using one of those hex wheels or whatever. So, I've thought about it, and I don't know where to start. I am sending comps out this week to my xht...

How to use javascript with an asp.net dropdownlist control?

I don't currently use ajax.net though I would be open to it if it is the only solution. I have a auto-complete control on screen that I am using to populate a asp.net dropdownlist with values through javascript (jQuery). I have had to use EnableEventValidation="false" to allow this. After I add my options to the select and the form is po...

Getting value from a cell from a gridview on RowDataBound event

string percentage = e.Row.Cells[7].Text; I am trying to do some dynamic stuff with my GridView, so I have wired up some code to the RowDataBound event. I am trying to get the value from a particular cell, which is a TemplateField. But the code above always seems to be returning an empty string. Any ideas? To clarify, here is a bit t...

Problem with a gridview, paging and "object reference not set" error

I'm stuck with the following problem. I'm trying to implement a basic GridView paged result set, which connects to an Oracle database. By itself, the GridView, and the paged results, work fine. The problem comes when I try to put it in page layout class that we have at work. We have ClassA, which inherits from Page, and is a corporate s...

Determine site's absolute, fully-qualified url in asp.net

How can I consistently get the absolute, fully-qualified root or base url of the site regardless of whether the site is in a virtual directory and regardless of where my code is in the directory structure? I've tried every variable and function I can think of and haven't found a good way. I want to be able to get the url of the current ...

How do you store the markdown using WMD in asp.net?

I have implemented the WMD control that StackOverflow uses into a project of mine, it almost works like a charm ... but ... when I save the changes to the database it is saving the HTML version and not the markdown version. So where I have this in my text box: **boldtext** It is really saving this: <b>boldtext</b> Any ideas how ...

.NET can't find the cookie that I created in classic asp in some cases.

I'm the only developer supporting a website that's a mix of classic asp and .NET. I had to add some .net pages to a classic asp application. This application requires users to login. The login page, written in classic asp, creates a cookie that .net pages use to identify the logged in user and stores information in session vars for the o...

how do I create an array or list of ASP.NET checkboxlists

I know how to use the checkboxlist in ASP.NET to display options retrieved from a database. What I don't know how to do is to make this 2-dimensional. That is, I need a list of checkboxlists where I don't know how long the list is; both dimensions of the checkboxlist will be determined by list of people (pulled from database) list o...

ASP.NET: ICollection Constructor Not Found?

I have a ASP.NET application running on a remote web server and I just started getting this error. I can't seem to reproduce it in my development environment: Method not found: 'Void System.Collections.Generic.ICollection`1..ctor()'. Could this be due to some misconfiguration of .NET Framework or IIS 6? Update: I disassembled the co...

ASP.Net Web Site Won't Compile, But Works Anyway?!

I have an ASP.Net 2.0 web site, using the DotNetNuke framework (4.09), and it will not compile, but when I hit the site in a browser, it works. Even the parts that don't compile will work. How is IIS able to compile and run this site, when Visual Studio can't? Everything is the same in both places... I copied the entire web site from the...