asp.net

What exactly does a server control e.g. a TextBox do, around the time it fires its Init event?

My understanding is a server control's constructor is called by the page's constructor. This happens before Page_PreInit event. A server control's Init event fires after Page_PreInit. It seems a server control does not do much during the Init stage? Then why bother giving much emphasis to Init stage? ...

HttpContext.Current.User.Identity.Name not right when simultaneous login from 2 machines

Hi, I've got an ASP.NET webserver with IIS 7. My authentication code (forms authentication) is as follows on the login page: var isAuthenticated = Membership.ValidateUser(usernameTextBox.Text, passwordTextBox.Text); if (isAuthenticated) { FormsAuthentication.RedirectFromLoginPage(use...

ModalPopupExtender stops working in GridView

Hi, I have an Ajax ModalPopupExtender inside a GridView with AllowPaging="true". On the first page it works fine, when you cycle through the other pages this stops working. Can anyone point me in the right direction please? Code as follows: Settings for GridView: <asp:GridView ID="gvwComments" runat="server" AllowPaging="True" ...

How to display elements only if SQLDataSource has rows

Hi all, I'm creating an ASP.NET/C# page where a user enters an ID at the top of the page, and when they press Submit, the page posts back and displays the data. Right now, the data fields are displayed at all times - even when the page loads and no search has taken place. This is not ideal as when they navigate a Menu with a MultiView I ...

InstantiateIn and user controls

I want to add my user control in InstantiateIn like this: public void InstantiateIn(Control container) { PIMVisualizer pimVisualizer = new PIMVisualizer(); container.Controls.Add(pimVisualizer); container.Controls.Add(new Button() {Text="asdf"}); } but the control doeas not appear on the page (the butt...

Unable to logout from ASP.NET MVC application using FormsAuthentication.SignOut()

I am trying to implement Logout Functionality in ASP.NET MVC. I use Forms Authentication for my project. This is my Logout code: FormsAuthentication.SignOut(); Response.Cookies.Clear(); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket( 1, FormsAuthentication.FormsCookieName, DateTime.Today...

How to create a CheckBoxListFor extension method in ASP.NET MVC?

Hi, I know there is a ListBoxFor extension method among the ASP.NET MVC Html helper extension methods, but I always thought that a checkbox list is more user-friendly than a list box. There was a very convenient CheckBoxList control in good old WebForms, but obviously that is out of the picture now. The question is, why is there no wa...

Custom Attribute in ASP.NET for Page_Load

Hi, I have an ASP.NET 3.5 Site where, in some places, I am checking if the currently logged on Active Directory user is in a certain AD Security Group. In the Page_Load I'm doing something like this: if (isInADGroup(UserGUID)) { //proceed } Now I was wondering, couldn't I just create a Custom Attribute, like some of MVC's securit...

Response.AddHeader("Content-Disposition") not opening file in IE6

Hi I'm using Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.HtmlEncode(FileName)); to pop a 'open/save file' dialog for the users, so that they can download an file on to their local machines. This is working good normally in IE7,But on IE6 the file is not opening when user click on the open button in 'open/...

How to make visibility of row false in case of mozilla firefox?

I have taken table inside that i have taken the row. in design mode when i make the visibility of row as false then there is pair of line comes which represents like there is row. How to make this line invisible when row visibility is false. In case of Internet explorer the pair of line not come when rows visibility is false. same thi...

Insert hidden column in asp:GridView but still available client side

This is simple. All I want to do is insert a hidden column into an asp:Griview that I'll be able to access through javascript. Any pointers? ...

functionality for a title textbox.

Hi, I am designing a question module. What i want is while i'm typing something in a textbox (called title), it should list titles of other questions that have already been asked. But not done as AutoCompleteText. I'd like those listed questions to pop up near the textbox and be set as a hyperlink, and by clicking on that link will res...

Authentication settings in IIS 7.5 and ASP.Net, what is difference?

Hi, I just start to learn web programming using IIS 7.5 in windows 2008 R2, and ASP.Net 4. I notice that both IIS and ASP.Net can define Authentication rules. In IIS, there is a form authentication setting where I can redirect user to specified page for authentication, like below: And then, in ASP web.config file, I find similar sett...

Retrieve if an Updatepanel has made a postback

Hey, Can somebody tell me if I can retrieve with JavaScript above the ASP.NET Updatepanel had made a asynchronous postback ? Thank's for help ! ...

How can I retrieve a subset of data from entity object data source and pass to another page

I am playing about just now trying to teach myself a little bit about the entity framework. I have a Gridview data bound to a Entity Date Source using the Entity Framework. If I select certain items in that list I then wish to redirect another page and populate another gridview with just the items selected (but with more detail, differ...

Validate an image path in javascript

I have an image like: img src="" class='listPartialLoader' alt='loading' I am assigning the 'src' value with data from an ajax call. Some times if the image is not found I want to add a default image path like"Images/default.jpg". But how can I check whether the image is exist or not using javascript? (Basically I want if the image is ...

How to print a LinkButton to page?

Say I have a dynamically generated LinkButton in my ascx.cs code-behind. How could I go about "printing" this control to my page? Obviously I can't do something like just print the Text property as I need the button to retain its hyperlink. I'm guessing I want to use the WebControl.Render method, but I'm not familiar with it at all and h...

What's the best practice for transferring huge binary files with ASP.NET ?

Consider an ASP.NET page with this code: while (read) { Response.OutputStream.Write(buffer, 0, buffer.Length); Response.Flush(); } The application should be highly performance-tuned and handle thousands on concurrent requests and the main purpose is transferring huge binary file to clients over high speed connections. I can do t...

No dll compiled in visual studio 2008 express when built

Hi, I'm a .NET newb, so forgive me if this is a stupid question. I've inherited a website which I've amended and now need to rebuild. I've opened the .sln file in VS2008, made my changes to the files and clicked 'build > rebuild website'. This seems to run okay - it outputs a load of comments in a panel at the bottom as it's building...

how can i retrive thumbnail-URL from azure table.

hi, i have some image URL in azure table. i use public IEnumerable Select(string Customer_ID) { var imageDetailQuery = CloudStorageAccount.DevelopmentStorageAccount .CreateCloudTableClient() .GetDataServiceContext() .CreateQuery<GuestBookEntry>("GuestBookEntry"); var gue...