.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Problems with postbacks, visible/hidden controls

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :ASP.Net


I am having some unusual issues with web forms on my public-facing internet servers.  I can run everything fine both locally and on my internal intranet servers.  I have forms that show or hide table rows depending on what step you are on in the form.  This form reads and writes to a SQL database via a Web Service.  I have eliminated AJAX or JavaScript issues by creating a simple test form that is showing the same erronious behavior...

Web Service:

using System;
using System.IO;
using System.Web.Services;
using System.Xml;
using taExternalTestTableAdapters;

namespace nsExternalTest
    [WebService(Namespace = "nsExternalTest")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class ExternalTest : System.Web.Services.WebService

        public ExternalTest()

        public int GetEmpID(string empLogin)
            EmpTableTableAdapter taEmp = new EmpTableTableAdapter();
            return Convert.ToInt32(taEmp.GetEmpID(empLogin));
        public bool InsertMessage(string message, string empID)
            bool success = true;
                TestTableTableAdapter taTestTable = new TestTableTableAdapter();

View Complete Post

More Related Resource Links

Sharepoint Foundation 2010 problems with Office 2007 ActiveX controls

I have a SPF server that I recently upgraded from WSS 3 using the database attach method. The new server configuration is SQL 2008 R2 with SPF 2010 on Windows 2008 64bit SP2. Mostly things are working fairly well, though there have been a few fires to put out. The latest inflamation seems to be centered around ActiveX controls for Office 2007. I'm getting the following message whenever I try to create a new document using the New button: " 'New Document' requires a Microsoft SharePoint Foundation-compatible application and web browser. To add a document to this document library, click the 'Upload Document' button." On the client side, the browser is IE8 on Windows 7 (Windows is 64bit, though the browser is in 32 bit mode.) using Office 2007. I've also had the same problem with systems running XP. In terms of troubleshooting, other activeX related features seem to be working fine. I can open datasheet views, if I click on a document, it will open in the appropriate client. However, I have some libraries where the Word document template opens the document information panel and those will give thhe following message on open: "One or more ActiveX controls could not be displayed because either: 1)Your current security settings prohibit running ActiveX controls on thi page , or 2) You have blocked a publisher of one of the contols. As a result the page mi

Rearrange dynamically visible controls on a page

Hello,Here is what I am trying to do.I have a drop down list along with a 'Add' button (which are always visible). There are some other 'Label', 'TextBox', 'Button' in the page (which is not visible on load). Depending on the user selection from the first dropdown (and when click on 'Add' button), I would like to dynamically set some of the Controls visible.For example (as per below code): When User selects 'Email' ... Label3, TextBox3 and Button3 will be visible. Again when user will click Button3, all controls will be invisible. I was able to Show and Hide those controls as per user selection and button click. What I would like to do is, rearrange the controls. For example, If user selects 'Email' and click 'Add' button (Button5), It would display 'Label3', 'TextBox3', 'Button3'. Then if user selects 'Name' from the dropdown and click 'Add' button again, it would display 'Label1', 'TextBox1', 'Button1' below the Email controls. As of now it is apperaing on sequence as listed in html (Name controls always come first when visible, then 'Phone', then 'Email'). I would like to display the controls as sequesnce as user selects.And next is when we will click the Button3 (which will hide the email controls), All other controls below email co

Missing Data From Hidden Layout Controls

We have several reports written in SSRS 2005 which use multiple datasets.  On the layout tab, we have a table which is hidden that is used to load an array of values from one dataset by calling a method in the code block.  The main table which displays the data uses another dataset, but it also calls a second method in the code block to search the array loaded by the hidden table and look up values matching on a key field.  In SSRS 2005, this works fine presumably because we could always depend on the hidden table being generated first.  However, when we converted to SSRS 2008 R2, this no longer works.  Is there a workaround available?

Hidden cells become visible when PageIndexChanging fired


I am having an issue with hidden cells when a PageIndexChanging event is fired in a gridview.

On the page_load I am setting the visibility of an edit button in a cell of a gridview to true or false depending on a users credentials. 

Everything works as intended when the page is first loaded. When I click to a different page index the edit button is visible in all cells when it shouldn't be. The edit button is then visible in all cells even if I navigate back to the first page.

Here is the pageindexchanging event:

protected void GridView_EmployeeList_PageIndexChanging(object sender, GridViewPageEventArgs e)


    GridView_EmployeeList.PageIndex = e.NewPageIndex;



Here is some code from the page_load:

protected void Page_Load(object sender, EventArgs e)


    foreach (GridViewRow row in GridView_EmployeeList.Rows)


             If(row.Cells[1] == "Manager")



How can I create a custom control that adds other controls visible to the page hosting my custom con


I want to create a custom control where I define several specifically named DIV sections.  The code-behind logic of the custom control will perform operations on these named DIV sections.  The page where the custom control is hosted needs to be able to add named controls to the DIV sections and perform operations on these named controls added to the DIV sections.

Let me explain a little further.  In the custom control, I want to have code behind logic that fires the following Page Event and uses a condition to make one or another specifically named DIV section visible or not:

    < _
    ToolboxData("<{0}:BaseDetails runat=""server""></{0}:BaseDetails>") _
    > _
    Public Class BaseDetails
        Inherits UserControl

        Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
            DetailsNameDiv1.Visible = False
            DetailsNameDiv2.Visible = False

Problems with Repeater Control, Update Panel and the Toolkit controls


Hi Guys,


Having a bit of an issue with the Toolkit controls.

I have a Repeater Control nested inside the Update panel, the repeater item template contains a multiview control allowing users to flick through seperate bits of information. This was working fine the async update was perfect, no issues.

I have then decided to include the rating control to one of the views. problem is now everytime i want to change the view it causes the whole page to postback.  

Attached is the code.

Any help is much appreciated

How can I make controls inside a Template visible to Code-behind


I have created a custom control that implements Templates (based on Panel controls) ... I can do a FindControl to locate imbedded controls.  This allows me to get and set values in the imbedded controls, but I want to be able to reference the imbedded controls like they are properties of the associated panel.  Here is a sample of how my custom control now works:

<cc:CustomControl ID="myCustomControl" runat="server">
<asp:TextBox ID="myTextBox" runat="server"></asp:TextBox>

I can do the following (where my custom control has given the panel hosting the template the name "myPanel"):

Dim txt As TextBox = myCustomControl.myPanel.FindControl("myTextBox")
txt.Text = "Some text to put in TextBox"

What I want to do is:

myCustomControl.myPanel.myTextBox.Text = "Some text to put in TextBox"

Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

Custom Controls in C# .NET

Embedding user controls in a Windows form is just like adding a simple button or text box that are already provided with .NET. These basic controls were written essentially like you code your own controls. Typically the controls you design are to be used in multiple forms or to modularize your code. These reasons help reduce the amount of code you have to type as well as make it easier for you to change your implementation. There should almost never be any reason to duplicate code because it leaves a lot of room for bugs. So, implementing functionality specific to your control in the control's source code is a good idea. This reduces code duplication as well as modularize your code, which is a good programming guideline.

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

Using ASP.NET 3.5's ListView and DataPager Controls: Displaying Data with the ListView

Prior to ASP.NET 3.5, developers who needed to display a set of records could choose between the GridView, DataList, and Repeater controls. The GridView provides rich data features, but has a very boxy layout; the DataList and Repeater allow for a more flexible layout, but lack the "point and click" data features found in the GridView, DetailsView, and FormView controls. The ListView bridges the gap between layout flexibility and built-in data features.

This article, the first in a series of articles on the ListView and DataPager controls, looks at the ListView's many available templates and illustrates how to display data. Read on to learn more!

Top .NET Performance Problems and how to avoid them

Every time I work with one of our .NET customers to help them with managing their application performance I come across the same problems as seen with other clients before: lots of ADO.NET queries, many hidden exceptions in core or 3rd party .NET libraries, slow 3rd party components, inefficient custom code

Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

Working with DropDownList and ListBox Controls in ASP.NET

"In my application i am using dropdownlist to display all categories from a table. When the user clicks this control I display all records in that category. Category table also contains column called color.

I wanted display some categories in dropdown list different color and others in different color using ASP.NET."-Anonymous

How to programmatically add controls to Windows forms at run time by using Visual C#

Create a Windows Forms Application
Start Visual Studio .NET or Visual Studio 2005 or a later version, and create a new Visual C# Windows Application project named WinControls. Form1 is added to the project by default.
Double-click Form1 to create and view the Form1_Load event procedure.
Add private instance variables to the Form1 class to work with common Windows controls. The Form1 class starts as follows:

Dynamically Create Controls in ASP.NET by Using Visual C# .NET

This article demonstrates how to dynamically create a control for an .aspx page. The sample project does the following:
Creates two TextBox controls.
Verifies that the contents (TextBox.text) and the attributes of the TextBox are saved across posts to the server.
Illustrates handling events that are posted by a dynamically-created control

Dynamically Create Controls in ASP.NET with Visual Basic .NET

This step-by-step article describes how to dynamically create controls for an ASPX Web page.

The sample project does the following:
It creates two TextBox controls.
It verifies that the TextBox contents (TextBox.text) and attributes are saved across posts to the server.
It describes how events that are posted by a dynamically created control are handled.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend