.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

Modify the properties of all controls on a page at once?

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

I have a webform of fields.  This information is for a database modifying interface we're going to use internally, so the information that pops up is sensitive, and therefore in order to avoid any kind of stupid accidents, I've got the fields disabled initially.  Then there is an "Unlock" button which enables all of the fields if you do want to make a change.

My code behind looks something like this when the Unlock button is pressed:

    protected void UnlockClientFields()
        NameETextBox.Enabled = true;
        NameJTextBox.Enabled = true;
        GenInfoTextBox.Enabled = true;
        InstDirTextBox.Enabled = true;
        DBDirTextBox.Enabled = true;
        AddressTextBox.Enabled = true;
        StationTextBox.Enabled = true;
        MapTextBox.Enabled = true;

This works just fine.  No problems.  Question is, is this the most efficient way?  If we decide a field later, the only way to include that in the Locked --> Unlock function is to come in here and add it manually?  The reason I ask is that, we have multiple pages in this database modifying process, so I have essentially the same code as above, except for UnlockContactFields, UnlockPCFields, UnlockCaseFields, and so on.  A good portion of the code is just Unlock methods

View Complete Post

More Related Resource Links

Not getting multiple composite controls on master page


I have created two composite controls in the same assembly and registered that assembly in a master page using <%@ Register tag.

When I try to use these controls using the registered tag prefix I am getting only one control along with the tagprefix .

How to get all the composite controls present in the registered assembly?

User Control not accessing the value of the properties send to it from the aspx page.


I have a dynamic accordion on a page. Set its datasource to an object of paged data source.The user control is in the accordions content template. When i was writing code the properties were showing but after giving the values of databases as


<uc:UserControl1  runat="server" Property1='<%#DataBinder.Eval(Container.DataItem,"columname1")%>' Property2='<%#DataBinder.Eval(Container.DataItem,"columname2")%>'  ></uc:UserControl1>


but the values shows null, these properties are shown as textboxes text property by user control.

MoreOver when I checked the values of database Items.So i made a textbox instead of usercontrol here as

<asp:TextBox ID="txtTest" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Columname1")%>'></asp:TextBox>

It is showing the correct value. And if i pass the value directly it is also showing correctly like

<uc:UserControl1  runat="server" Property1="XYZ")%>' Property2="ABC")%>'  ></uc:UserControl1>

. where I am wrong

the problem is eval is not passing the value to usercont

allow client to modify text on web page


I have been trying to find out how I can allow a user to modify/update a page/pages on a web site. I understand there has to be site security with authentication and authorisation but what is there as a user interface for them easily to update a page? 

Thanks for any pointers.

Cannot set custom attributes on mobile controls in this page



I am beginner at mobile Pages with ASP.NET. And i want to make an application with contains  a few TextBox that have different size.

it's my sample code here:

<%@Page Inherits= "System.Web.UI.MobileControls.MobilePage" Language= "C# " %>
<%@ Register TagPrefix= "Mobile" Namespace= "System.Web.UI.MobileControls " Assembly= "System.Web.Mobile" %>
<Mobile:Form runat="server" id="form1" Paginate="true" >
<Mobile:Panel Paginate="True" runat=&

In a style template, express a property in terms of the controls properties it is applied to.

Hello,   In the style template below, which works fine, I'd like to express the "Points" property in terms of the applied to controls "Width" and "Height" properties.  As you see, the "Fill" property is expressed in terms of the "Background" property the template is applied to by means of Fill="{TemplateBinding Background}".  The following does not work:   Points="0,({TemplateBinding Height} / 4)  ({TemplateBinding Width} / 12.5),({TemplateBinding Height} / 4) . . ."   Is what I'm looking for possible, all in XAML, no code/converters? <Style x:Key="FolderButton" TargetType="Button"> <Setter Property="Margin" Value="2.5" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Grid> <Polygon Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" Points="0,5 4,5 6,0 23,0 25,5 50,5 50,20 0,20"/> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </ControlTemplate>

Maintain Controls State on Master Page.

I have Web Application which uses the Logged In User (Authenticated User) to query his Profile Data from Adabas/Unix using OLEDB. The application provides the user with about 21 different pages (Basic Info, Employment Info, Education, Dependants, Financial Info ...). The web application has a master page, and each profile data page is based on a User Control loaded in the Child ASPX Page. Since we are migrating our legacy applications from Adabas/Unix to SAP, the development Team has prepared web services to query for the same Profile Data from SAP using Web Services. Now, we have to modify the web application to consume the web services instead of using OLEDB to query Adabas. Since we are in the testing phase, and we have only very limited data in SAP, I have to provide temporary control to allow test query the Staff Profile for a Specified User (instead of the Authenticated User) and to select the Source: 1. SAP, or 2. Adabas.   So I am thinking to add the following "Control Section" in the Master Page:<div runat="server" id="divSAPTest" class="SAPTest"> <span>Test SAP Web Services. Enter Staff ID: </span> <asp:TextBox ID="txtSAPStaffID" runat="server" Width="60px"></asp:TextBox> <span>From: </span> <asp:DropDo

Page has one or more controls that do not correspond with con

I'm posting this in VS 2008 forum since I wasn't getting this error when this was in VS 2005.  It's complaining about my content tags but I have not a clue why, everything looks fine to me.  I've included the master page so what's the deal? <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Sub.master.cs" Inherits="Web.MasterPages.Sub" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title id="Title" runat="server" /> <link id="main_styles" href="~/main.css" rel="stylesheet" type="text/css" /> <style type="text/css"> body { background-image: url(images/back.jpg); } .style1 {color: #B92722} #bigImg { position: absolute; display: none; } </style> </head> <body class="Mainbody"> <form id="form1" runat="server"> <!-- Main Table --> <div class="centered-table"> <table width="100%" border="0" cellspacing="0" cellpadding="0"&g

Master page controls

If I have a hidden control in the master page and access it in a content page, I m using like as follows   document.getElementById('ctl00_ctl00_Container_hdnfield').value Actually the id I have mentioned is the dynamically generated one, it may change if do some changes. Can I know is there any way to get the dynamically created id for the controls? Regards Zameer  

Accessing controls / events on a master page from child page

I have a problem i am trying to work out the best method with my limited skills. Im using vb.net ( VS 2010  ) I am using a dll for an IFrame , which is call from code behind.  On my site I havea masterpage which has two gridviews. ( GrdViewWebBureau is the one i am using for this  query)  GrdViewWebBureau is contained within an update panel and updated on a timer control trigger. GrdViewWebBureau updates the page with file counts and status from our clients. I can click on any one of the cells and the code behind is fired. What I am trying to do is put an IFrame on the master page and every time a user clicks on the grid, the Iframe is fired up.  I have tested the iframe and vb code behind from a dummy page and it works, however when the Iframe is on the master page it doeant work.  What I am tryingh to achieve is that no matter what page a user is on the site, they will be able to click on the GrdViewWebBureau and the iframe will fire with the correct childpage. Each webPage may also have an Iframe as well, so i dont know if it is possible to make the IFrame global and just call that control ??  I have no idea if 1 this is possible with the code i have and 2, if i have the brains to understand the who what why and when. Please can you look at my code and pass anyt suggestions / help /  solutions. Master Pa

SPWeb.Properties is not persist over the redirect page.

Hi, I have to pass some object from my code to another redirected page. So I serialize the object and serialized string is save to SPWeb's property as a string and after that I use SPUtility.Redirect('Url'). But on redirected page above updated property is not find in the SPWeb.Property collection. string xml = MyClass.GetXMLFromObject(exInfo); SPContext.Current.Web.Site.RootWeb.AllowUnsafeUpdates = true; SPContext.Current.Web.Site.RootWeb.Update(); if (!SPContext.Current.Web.Site.RootWeb.Properties.ContainsKey("MyInfo")) { SPContext.Current.Web.Site.RootWeb.Properties.Add("MyInfo", xml); SPContext.Current.Web.Site.RootWeb.Update(); } else { SPContext.Current.Web.Site.RootWeb.Properties["MyInfo"] = xml; SPContext.Current.Web.Site.RootWeb.Update(); } SPContext.Current.Web.Site.RootWeb.AllowUnsafeUpdates = false; SPContext.Current.Web.Site.RootWeb.Update(); SPUtility.Redirect("RedirectToErrorPage/ApplicationPage1.aspx?ExInfo=" +xml, SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current); Redirected page code: if (SPContext.Current.Web.Site.RootWeb.Properties["MyInfo"] != null) { using (SPWeb web = SPContext.Current.Site.OpenWeb(SPContext.Current.Web.Site.RootWeb.Url)) { TextBox1.Text = Convert.ToString(SPContext.Current.Web.Site.Root

modify/override properties of default sharepoint modal dialogs (ex. editview.aspx) using javascript

Hello all, I would like to know how can I modify (override) some properties of the default sharepoint modal dialogs using Javascript. Ex. the size and location of editview.aspx. I while ago I asked a question about overriding the DialogResult in the display view dialog. I got an answer from Zach which looked like this:             sb.Append("<script type=\"text/javascript\">");             sb.Append(@"window.setTimeout(function () {");             sb.Append(@"if (window.frameElement && typeof(window.frameElement.overrideDialogResult) == 'function')");             sb.Append(@"{");             sb.Append(@"SP.SOD.executeFunc('sp.ui.dialog.js', 'SP.UI.DialogResult.OK', function () {");             sb.Append(@"window.frameElement.overrideDialogResult(SP.UI.DialogResult.OK); ");             sb.Append(@"});");             sb.Append(@"}");  

Dynamic or Expression-based Report Page Properties

Hello, I have a tablix(table) with column grouping making the number of columns dynamic. Although our customers have been warned that this could lead to the columns going beyond the edge of the normal landscape 8.5x11 inch page, they have asked for alternate solutions. Beyond rotating the column labels and reducing fontsizes, the issue is not so much that it goes off the page, but the fact that in print preview mode the data is broken up requiring that you go to the next page to get the remaining data. What I am investigating is whether the Page Properties of the report body, either the pagesize property and/or the interactivesize property, can be manipulated at run time? This way if a user, based on their experience with the parameters they usually select and pass into the report, knows that the results will span the length of the page onto a second page, could choose a new parameter such as pagesize/interactivesize so that it changes from 8.5/11 to perhaps the next standard page size of 8.5/14 inches? This does not mean the contents would change during the course of rendering the report, just a new input that could decide at run time what paper size to use in print preview mode.   Thanks.

Modify a batch of user controls

In a regular webform, I can enable a batch of textboxes Visibility switch on with the following command... Private Sub SetTextBoxesVisible(ByVal Page As Control) 'Iterate through controls, setting data textboxes visible For Each ctrl As Control In Page.Controls If TypeOf ctrl Is TextBox And Strings.Left(ctrl.ID, 4) = "dtxt" Then CType(ctrl, TextBox).Visible = True Else If ctrl.Controls.Count > 0 Then SetTextBoxesVisible(ctrl) End If End If Next End SubBut in an ajax webform, the above code will not work.Does anyone has any suggestion on how to tweak this subroutine?

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

Change a controls properties from another window

I have a WPF App that opens a window (MainWindow) and has a button control that creates a new instance of a Window2 class and calls window2.show() When I click this button I disable it from within MainWindow code. The question I have is when the Window2 onclosing event is called  how do I access the Mainwindow button properties to enable it again. TIA Mike

Documents link in Edit properties Page

Hi, my requirement is, the document library's editform should have a link to document like list's editform. please guide me to get this, Thanks in advance.

Copying the whole layout with controls from one aspx page to another page in runtime

Hello all Here is my issue. I've a page main.aspx. This page has a button 'Settings'. When it is clicked, I load another aspx page settigns.aspx in a popup. Now in the settings.aspx i allow the users to add controls dynamically. For example the user can create 5 textboxes. When he saves it there, I need to get that controls to main.aspx. So i need to move all the controls from one page to another page. I'm not able to think of a solution with user controls. Any ideas on this?
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