asp.net

ASP.NET - Dynamically created button

I have added a dynamically created button in my Webform. But its click event is not working. Can anyone please explain why? This is my code: Button save = new Button(); save.ID = "btnSave"; save.Text = "Save"; save.Click += new System.EventHandler(this.Save_Click); Webform.Controls.Add(save); protected void Save_Cl...

App_Data/ASPNETDB.MDF to Sql Server 2005 (or 08)

I've been developing an ASP.NET WebForms app that needed account login functionality (e.g. register new users, change passwords, recover passwords, profiles, roles, etc). To do this, I used FormsAuthentication with the default data store, which, to my surprise, is an MDF file in App_Data. When it comes time to actually deploy this app. l...

Calling a vb linkbutton’s(within a user control) click event from javascript

how can i call a VB function - deleteevent() in usercontrol.ascx.vb from a javascript function in clickhandler(e) in usercontrol.ascx. The call should cause a postback because i need the usercontrol to display the changes. i am currently trying to do it by using a linkbutton with style display:none, and calling its click event from the ...

publishing SQL 2005 Database to Remote Host

Hi, I've made an ASP.NET 2.0 website and it uses two databases namely aspnetdb and my_db.I ran the aspnet_regsql.exe -E -S localhost -A mr tool and I got the aspnetdb.mdf in my project.I used it for providing login features to my site. Now i want to publish the site to a remote hosting server which I've purchased. They have provided me ...

Customizing an AJAX AutoCompleteExtender with a checkbox

I wanted to implement a multi-select AutoCompleteExtender that displays a checkbox on each row. I found some examples that implement checkboxes in dropdown lists, but nothing involving the AutoCompleteExtender. Any ideas? Thanks. ...

Reflection for validation

CustomerValidator: AbstractValidator<Customer> How might one dynamically instantiate the class above if passed an instance of a Customer?? Similarly if I had: Cat c = new Cat(); I would want to dynamically invoke the class that implements AbstractValidator<Cat> ...

Linking an ASP.NET web page to another project's code file

I have a series of .NET 2.0 web pojects that have identicle code behind in their web pages. The only thing that is different is how the html is laid out. Is there a way that I can have a main web project that holds all the code behind (including control events like button click) and so that the other web projects reference the web page...

How to update an asp.net website (just changed files)

Hi all : I am developing an asp.net website that will need regular updates for source codes and HTML sides. After i have completed the necessary updates, i use the 'publish website tool' and publish the site to my local directory. Then i upload all files to Remote File. Is there any way to fix my site with just changed files. For examp...

VB ASP.NET sending data to a flash movie

I have a "label" in a Flash Movie. I need to send a data from the server side and this data must be displayed on the Flash movie. How can I implement this? ...

How does one discard a session variable while closing Web Page?

Hi all. We are following a procedure in our work while developing a web page, is to bind page to one or more session variables, these session variables are used only for that page, to hold current processing objects, so while closing page no need for them. How could I discard these session variables while closing page? Any suggestions ...

RadUpload in FormView in RadAjaxPanel

I have a RadUpload in the edit template of a FormView. My desired behaviour is Formview should open in ReadOnly Mode On clicking the update button, a postback should occur So the desired transition scheme is ReadOnly->Edit should be Ajaxified Edit->Readonly should be postback. I have tried using this post, but I cannot access the u...

Dynamically created button

When I click a button I need to create some Textboxes dynamically. The values of the textboxes must be entered in the database by clicking a button which should be enerated dynamically below these textboxes. How do I acheive this?? I need to have a Click event for this newly generated button. ...

Page Refresh Causes Duplicate POST in ASP.NET Applications

i have an application in which i am adding a new record and the record is added two times if i am pressing refresh button. I am clearing the cache but i am having the same problem. what to do? ...

Programmatically deciding what file a URL should point to with ASP.NET 3.5 and IIS 7

Is it possible to programmatically resolve a URL to a file using ASP.NET and IIS? Specifically I'd like the file to be outside of my Virtual Directory (could be anywhere on the local file system). So if a URL comes in like http://mysite/somepicture.jpg I'd like to be able to return c:\mypicture.jpg. I looked into creating an IHttpModu...

Are Try Catches still useful?

When I first started programming in .NET I used try/catches all the time. I am finding lately though I rarely ever use them for web applications. My exception (no pun intentended) is unmanaged code that could potentially create a memory leak such as com objects. Are they really needed anymore or do they just clutter things up? UPDATE: ...

Asp.Net SQL Refresh page duplicate inserts?

I have a *.aspx page that contains a text box and a button. When the user enters information in to the textbox and clicks post, it inserts the data into my sql database. The issue is, that if the user hits refresh, it will keep inserting the same data into the database. I am pretty sure the whole "click" method is called, not just the in...

Using a class like a public variable in asp.net

I'm getting an error in .net when trying to declare a Public class on my code behind page. Partial Class _Default Inherits System.Web.UI.Page Public someVariable as integer Public someClass as className Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load [...] The error I'm ge...

Fill a word document in asp.net ?

I am working on Asp.Net project which needs to fill in a word document. My client provides a word template with last name, firstname, birth date,etc... . I have all those information in the sql database, and the client want the users of the application be able to download the word document with filled in information from the database. W...

Why does the MailDefinition class require a System.Web.UI.Control?

When creating a MailMessage object by calling the "CreateMailMessage" method on the MailDefinition class, the third parameter is an object of type System.Web.UI.Control. MailDefinition mail = new MailDefinition(); ListDictionary replacements = new ListDictionary(); replacements.Add("<%myname%>", "John"); mail.BodyFileName = "~/App_Dat...

5 Textbox, 2 Buttons. How to assign textBox to Button?

I want to give my users the option to use a textbox and press Enter. The challenge is that I have 5 textbox, and 2 options. 3 textbox belong to one button, and 2 textbox to the other. How do I trigger a particular Button according to the textbox the user was in when he press Enter? ...