Web Forms :: Enable / Disable WebControls Dynamically?

May 10, 2010

I have a webpage that inherits a masterpage. Within the webpage I have the content palceholder and then a table within that that contains all the controls of the page. Like below:

[Code]....

I want to be able to change the fields to readonly if a field in the database for the user says they should have readonly access. I can't seem to find the level to go to in order to loop through the controls of the page to set their access to readonly.

I have gotten down to this level and it seems like it is in the base of this.

WebForm.Page.TemplateControl

View 3 Replies


Similar Messages:

How To Enable Ajax When Deriving From System.Web.UI.WebControls.WebControl On Controls

Feb 26, 2010

I've built a class that derives from System.Web.UI.WebControl. It basically renders pagination links (same as what you see on top of GridView when enabled) for use above a repeater.I'm creating some anchor tags explicitly inside my nav control obviously, but they don't perform ajax postbacks. My understanding is that ajax requires POSTS to work right? Well, these would be GETs

View 2 Replies

Web Forms :: Textbox Enable And Disable?

Nov 15, 2010

using c# I am entering two types of string in a text box for eg "so-123456" or "12345678" only this two formats are allowed to enter, when i enter only 12345678 i.e, without "so" next textbox in that page should be enabled, if i enter "SO-123456" textbox should be disabled. without any click event i.e, while entering text in 1st textbox if it contains "so" textbox2 should be disabled, if textbox1 contains only integer(123456) textbox2 should be enabled.

View 1 Replies

Web Forms :: Enable / Disable Control With RangeValidator?

Apr 6, 2010

I have a text box, a range validator, and a button. The validator is hooked up and prevents the button from doing a post back if the text is out of the range, however I'd also like to enable and disable the button. Is this possible to do within client-side code?

View 12 Replies

Web Forms :: How To Disable / Enable RequiredFieldValidator / CompareValidator

Apr 26, 2010

How do I validate RequiredFieldValidator/CompareValidator conditionally. I have aded equiredFieldValidator/CompareValidator on date textbox. I want that if textbox1="No" thne it should not validate or compare date text box, if textbox1="Yes" then it should validate.

Is this possible on form submit button or any other way?

View 4 Replies

Web Forms :: Each Loop For Disable/Enable Textboxes?

Sep 2, 2010

I'm trying to set all textboxes on an ASP.NET form to disabled on Page_Load using the following:

[Code]....

View 6 Replies

Web Forms :: Disable & Enable ImageButton With Different Images?

Jan 23, 2010

I have developed toolbar which contains the First,Next,Last and Previous buttons, based on the records display the buttons needs to be changed. Now how to disable and enable the button from .cs file or by using .css file.

View 2 Replies

Web Forms :: How To Enable / Disable Login And Log Out Button

Apr 25, 2012

I have Query 

I am designing new website 

I want to know how I came to knoe whether user is logged in or not so that i can make visible log out button on MAster PAge 

I am able to log in but my log out button is not visible since after successfully login i am getting log in button visible and How to store value in session ("UI")  ? 

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Session("UI") Is Nothing Then
Logoutbutton.Visible = True
LoginButton.Visible = False
Displayprofile.Visible = True
Displayprofile.Text = "USER profile"

Else
Alert.Show("no session")
LoginButton.Visible = True
Displayprofile.Visible = False
End If
end Sub

View 1 Replies

Web Forms :: Disable And Enable Button - Nothing Entered In Textbox?

Aug 17, 2010

I have a webform with textbox and button,i want to disable the button when nothing is entered into textbox and if something is entered the button must be enabled.How to do it without javascript?

View 14 Replies

Web Forms :: Enable / Disable Fileupload Control With Javascript?

Jun 13, 2010

I have file upload and Radio button list controls in the page

Requirement:

When the page load, the file upload control has to be enable = false when I click on the radio button list's Yes option then it has to be enable = true and when No option is clicked then enable = false

View 3 Replies

Web Forms :: Enable Disable Validator Using DropDownList Selected Value

May 7, 2015

I have a dropdown list for the which values are coming from DB. There is one option name OTHER, when I select other the textbox appears. For that Textbox I have made a required field validator. Till here it works fine. But when I select any other option, still it gives me validator errors. It should not happen. It should only give me required field error when the user doesn't fills the textbox on select of OTHER option. Please see the code.

Dropdown and Textbox code:-

<asp:DropDownList ID="ddlGraduation" runat="server" CssClass="txtfld-popup_drp"></asp:DropDownList>
<asp:RequiredFieldValidator CssClass="error_msg" ID="reqGraduation" runat="server" ControlToValidate="ddlGraduation"

ErrorMessage="Please select graduation details" InitialValue="--Select--" SetFocusOnError="true"></asp:RequiredFieldValidator>

<asp:TextBox ID="txtOther" runat="server" CssClass="txtfld-popup_p"></asp:TextBox>
<asp:RequiredFieldValidator ID="reqOther" runat="server" ControlToValidate="txtOther" ErrorMessage="Please specify your qualification"></asp:RequiredFieldValidator>

JS code for hiding and show the textbox when user select and deselect the OTHER option from dropdown list:-

<script language="javascript" type="text/javascript">
function pageLoad() {
$('#ctl00_ContentPlaceHolder1_txtOther').hide();
$('#ctl00_ContentPlaceHolder1_ddlGraduation').change(function () {
if ($(this).val() === "Other") {

[Code] .....

How to achieve this...

View 1 Replies

How To Name And Find Dynamically Created Webcontrols In C#

Aug 10, 2010

I am trying to add a unique name to each textbox that I'm adding to a table.

I've tried:

TableRow someRow = new TableRow();
TableCell someCell = new TableCell();
TextBox someTextbox = new TextBox();
someTextbox.Attributes.Remove("name");
someTextbox.Attributes.Add("name",itsId);
someCell.Controls.Add(someTextBox);
someRow.Cells.Add(someCell);
theTable.Rows.Add(someRow);

The html generated includes both my name and the autogenerated name as attributes of the textbox.

Unfortunately, when I run a FindControl, by my name, I get a null reference, even though it still works to find it by the autogenerated name.

What do I need to do to find the control by my name? When / why is it autogenerating names for my controls?

Successful code:
TextBox tb = (TextBox)FindControl(autogeneratedID);
WriteToSomeOtherDiv(tb.Text);
Unsuccessful code:
TextBox tb = (TextBox)FindControl(myId);
WriteToSomeOtherDiv(tb.Text);

View 2 Replies

Web Forms :: Enable / Disable User Controls In Master Page

Oct 7, 2010

I have a user control in my Master page and need to be able to Enable/Disable it from ANY page. How is this done? My user control has a few TextBox fields and a button. I was hoping to set a public property and simply Enable/Disable, but public properties seem to only work on the Master page code behind and not other pages.

View 4 Replies

Forms Data Controls :: How To Enable / Disable Buttons In My Gridview

Jul 15, 2010

I'm trying to enable/disable buttons in my gridview according to a value in gridview's field.
But everytime when I try to run my page, it shows me below underlined error and point to my gvTimeSheet.DataBind() in page_load.

"Unable to cast object of type 'System.EventArgs' to type 'System.Web.UI.WebControls.GridViewRowEventArgs'."
I also tried to enable / disable button in HTML but it just against from what I need it to be.

Example, sheet_status = true, I do not need to enable the button.

[Code]....

View 5 Replies

Web Forms :: How To Enable Or Disable The Treeview Node Depending On Some Conditions

Jan 3, 2010

my asp.net application is workflow enabled.

by default all nodes of the tree should be disabled

once the workflow is completed.i need to enable the link of treeview??

my basic question is how to enable or disable the nodes the treeview depending on condition

suppose

if var a=0

then

LinksTreeView.SelectedNode.SelectAction = TreeNodeSelectAction.None;

View 1 Replies

Forms Data Controls :: Enable And Disable Columns In Repeater?

Sep 30, 2010

how can i enable and disable columns in repeater in the code behind

View 1 Replies

Forms Data Controls :: Enable / Disable The Checkbox In Gridview?

Jul 9, 2010

Based on some condition, I need to enable and disable the checkbox in gridview and that would be on page_load event.

View 1 Replies

Forms Data Controls :: Enable And Disable Gridview Selecting?

Dec 20, 2010

I have a gridview that is built based on my objectdatasource.. so at the moment, i have 1 gridview linked to 3 different objectdatasource resultsets.. my question is.. only 1 of the 3 do i want to allow or should i say enable the "GridView1_SelectedIndexChanged" ability. Is that possible, that when i bind the datasource to the gridview for that one, i can enable that?

View 4 Replies

Web Forms :: Enable Disable Validators Based On DropDownList Selection

May 7, 2015

I have 2 RequiredFieldValidator 

1-Rfvare
2-RfvareC

that I put RFvare.visible=false  and RfcareaC.visible=true

 and 1 dropdown list below is my code:

<div id="zirbanaval"> <asp:RequiredFieldValidator ID="Rfvarea" runat="server" ErrorMessage="*لطفا مساحت زمین را وارد نمایید." ControlToValidate="txtarea" CssClass="RfvareaC" Visible="false"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RfvareC" runat="server" ErrorMessage="*لطفا زیر بنا را وارد نمایید" ControlToValidate="txtMesure" CssClass="RfvareabanaC"></asp:RequiredFieldValidator> </div>

I want if users select item="Area" from dropdownlist then Rfvare.visible=true and RfvareaC.visible= false 

Below is code:

protected void ddltype_OSIC(object sender, EventArgs e) {
string code = ddltype.SelectedItem.Text;
switch (code)
{
case "area":
Rfvarea.Visible = true;
RfvareC.Visible = false;

[Code] ....

but it doesn't work I mean always it shows requiredFieldValidator==>Rfvare.visible=true)

View 1 Replies

Web Forms :: Enable And Disable Regular Expression Validation For Textbox

May 7, 2012

I having a two radio button. When the second radio button is enabled, a text box which accept the email id will appear. I am validating the Email using Regular expression validator.

When the second radio button is clicked, and I enter the invalid email id so that it shows me and error. But when I click the first radio button, it is  showing the save validation. I need this to not show the validation when the first radio button is clicked and invalid email id is there in the text box.

View 1 Replies

Forms Data Controls :: How To Enable / Disable TreeView Navigation Control

Feb 9, 2011

In asp.net(C#) i'm using masterpage and childpage.

in masterpage i used TreeView Navigation control to view the Childpage.

.What my doubt is......when i select the navgation control

my TreeView Control should be disable and when i click cancel button in Child page it will enable..

View 4 Replies

Forms Data Controls :: Enable Or Disable The ImageField And Boundfield In Gridview?

Jul 12, 2010

How to enable or disable the ImageField and Boundfield of gridview in the code behind inside page load?

aspx codes:

<asp:ImageField
DataImageUrlField="GreetingType"
DataAlternateTextField="GreetingType"
DataImageUrlFormatString="images/hello.gif"
HeaderText="Greeting"></asp:ImageField>

<asp:BoundField
DataField="Location"
HeaderText="Location"/>

View 2 Replies

Web Forms :: Enable Disable RequiredField Validators Based On Value Selected In DropDownList?

May 17, 2013

I have a dropdownlist ,three text boxes and a submit button.The three text boxes are disabled and enabled based on the condition in dropdownlist.I have provided required field validators in three text boxes.When I click on condition "self" then three text boxees are disabled and submit button click wont enter the values since required field validators prevent that.I have set causes validation property to false.But it wont work for the second condition where i need to enable all the textboxes,If i didnt provide any values it will enter nulll values to db.

View 1 Replies

Web Forms :: Enable Disable Validators In GridView Row Based On CheckBox Selection?

Nov 28, 2012

I have one gridview with two template fields check box and dropdown and my doubt is dropdown validation should occur only for check box selected items..

 In my form all the dropdown shows validation even though if check box is not selected

<Columns>
<asp:TemplateField>
<ItemTemplate>

[Code]....

View 1 Replies

Web Forms :: Enable Disable CheckBox In ListView Control Based On Database Value?

May 7, 2015

I want to make checkboxes which are already Checked to non editable or readonly to true.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved