Is there any way to change the enabled property of a dropdownlist without a
postback, depending on the selection in another dropdownlist?
Select Case ddlReport.Selec tedValue
Case "Profit"
ddlFormat.Enabl ed = True
Case "Trial Balance"
ddlFormat.Enabl ed = False
End Select 10 7067
Geoff, Is there any way to change the enabled property of a dropdownlist without a postback, depending on the selection in another dropdownlist?
No
Cor
"Cor Ligthert" <no************ @planet.nl> schrieb: Is there any way to change the enabled property of a dropdownlist without a postback, depending on the selection in another dropdownlist?
No
I assume that it's possible to disable another control using
JScript/VBScript without a postback, but that's slightly off-topic here.
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Geoff,
It sounds like you are talking ASP.NET.
As Herfried suggests. If you want to do it server side, then you need to do
a postback. If you don't want a postback, then you will have to do it client
side with JavaScript or VBScript.
For help with client side JavaScript & VBScript you may want to ask this
"down the hall" in one of the microsoft.publi c.dotnet.framew ork.aspnet
newsgroups.
Hope this helps
Jay
"Geoff" <cb****@earthli nk.net> wrote in message
news:6l******** *******@newsrea d3.news.pas.ear thlink.net... Is there any way to change the enabled property of a dropdownlist without a postback, depending on the selection in another dropdownlist?
Select Case ddlReport.Selec tedValue
Case "Profit"
ddlFormat.Enabl ed = True
Case "Trial Balance"
ddlFormat.Enabl ed = False
End Select
Geoff,
Although you have two answers from VBNet ASPNET experts who denies my answer
to you, my answer stays No.
This can be the information created in a webform page at client side, which
contains all information of the data in the serverside controls (from which
the dropdownlist is one) on your page.
<input type="hidden" name="__VIEWSTA TE"
value="dDw5Mzcw NzM4OTU7Oz6sJm5 Bgc+8ub9mK/REAxFYaxmlmQ==" />
I knew lot of JavaScript, however I do not know how to change this in a way
that I could assure that the information stays consistent.
Cor
> I knew lot of JavaScript, however I do not know how to change this in a way
I know a lot
Cor, Although you have two answers from VBNet ASPNET experts who denies my answer to you, my answer stays No.
That comment doesn't even warrant a response!
however I do not know how to change this in a way that I could assure that the information stays consistent.
You can turn off the ViewState for selected controls or all controls using
the Control.EnableV iewState which DropDownList inherits.
The Page directive also has EnableViewState attribute.
Hope this helps
Jay
"Cor Ligthert" <no************ @planet.nl> wrote in message
news:e1******** ******@TK2MSFTN GP09.phx.gbl... Geoff,
Although you have two answers from VBNet ASPNET experts who denies my answer to you, my answer stays No.
This can be the information created in a webform page at client side, which contains all information of the data in the serverside controls (from which the dropdownlist is one) on your page.
<input type="hidden" name="__VIEWSTA TE" value="dDw5Mzcw NzM4OTU7Oz6sJm5 Bgc+8ub9mK/REAxFYaxmlmQ==" />
I knew lot of JavaScript, however I do not know how to change this in a way that I could assure that the information stays consistent.
Cor
Addendum: Is there any way to change the enabled property of a dropdownlist without a postback, depending on the selection in another dropdownlist?
No
I assume that it's possible to disable another control using JScript/VBScript without a postback, but that's slightly off-topic here.
\\\
....
<html...>
...
<head>
...
<script type="text/javascript"><![CDATA[
function disableDropdown () {
document.forms[0].elements[0].disabled = true;
}
]]></script>
</head>
<body>
<h1>Dropdown list sample</h1>
<form>
<p>
<select size="1">
<option>Item1 </option>
<option>Item 2</option>
</select>
</p>
</form>
<p><a href="javascrip t:disableDropdo wn();">Disable dropdown list</a></p>
</body>
</html>
///
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Jay, You can turn off the ViewState for selected controls or all controls using the Control.EnableV iewState which DropDownList inherits.
You are right, and have with that given the direct answer for this question.
By setting the ViewState to False it should be pretty easy for everybody who
knows a little bit of JavaScript,
So my answer becomes Yes.
:-)
Cor
Geoff,
I was thinking a lot more in your question than there probably is, when it
is as simple as you ask is can be this a piece of JavaScript, however with
that is in my opinion still the data in the box with a postback sent back to
the server side ass well as the the selectedindex. When you want to affect
that you should do more using that viewstate enabled is false.
You can put a HTML button on your form to test it
<script language=javasc ript>
<!--
function Button1_onclick () {
if (document.all(" DropDownList1") .disabled == false) {
document.all("D ropDownList1"). disabled = true}
else
{
document.all("D ropdownlist1"). disabled = false}
}
//-->
</script>
When you want to integrate it in VBNet you can use
Dim scriptString As String = "The script including javatags"
Page.RegisterSt artupScript("Bu tton1_OnClick", scriptString)
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mike Hnatt |
last post by:
I have code that will set a drop-down list value to "xyz" and the .Enabled
property to False. However, when I do that I can no longer retrieve the
value "xyz" upon postback. It is as if I set the .Visible property to False
as well and the control wasn't rendered, but I did not. If you View Source
of the rendered HTML, you can see that the control is indeed still intact
(everything is the same except the disabled argument is set to...
|
by: Christopher D. Wiederspan |
last post by:
I'm wondering if there's a way to use javascript to disable a ASP.NET web
page before it starts to postback. Specifically, here's what I'm running
into. I've got a webform that has an autopostback dropdown box, and a couple
of textboxes just below it. When the user selects an option from the
dropdown, it triggers a postback event, which in-turn slightly adjusts the
remainder of the page.
The problem is that if the user is on a slow...
|
by: Al Cohen |
last post by:
I'm using a LinkButton to call some code, then do a redirect. The code
does some queries, sends some emails, and takes a few moments before the
redirect is performed.
I'd like to disable my LinkButton during this period to prevent multiple
submissions. (Obviously) the disabling should be done at the client
side to prevent any delay. I've tried adding some javascript to
LinkButton.Attributes:
LinkButton1.Attributes.Add("onclick",...
|
by: GD |
last post by:
Hi,
I wonder how to disable the "submit" behavior of a button. What I want is to
assign values to dynamically added user controls without page postback.
Problem: dynamically created control can not be accessed because the button
click trigers page postback(see sample code). When the button is clicked, an
error occurs: "System.NullReferenceException: Object reference not set to an
instance of an object."
Please help. Thanks.
|
by: Fluxray |
last post by:
--Background:
I have a webform including a datagrid. The datagrid is using template. Its
ItemTemplate is used to display a look-up-table with labels. its
EditItemTemplate is used to edit a row in the look-up-table with textboxes. I
have a linkbutton in each row (causevalidation = false) named 'Edit' to post
the page back such that the page is switch from display mode to edit mode
(labels -> textboxes for the row to be edited), and the...
| |
by: Robert Ladd |
last post by:
Hi,
I'm trying to disable the asp.net calendar control from a javascript
function, but it doesn't disable the doPostBack.
To simplify the situation, assume a page with 4 controls. A dropdownlist, a
calendar control, a textbox and an update button. What I'm doing is
initially setting the button to disabled, the other 3 controls are enabled.
If any data is entered in the textbox, I want to disable the dropdownlist
and the calendar...
|
by: junlia |
last post by:
Does anyone how how can we disable the auto-postback feature in asp.net page?
I have to use a server side control in the page, but the auto post back
feature in it causes problems for me. Please help!
Thanks much,
Junlia
|
by: Arvind P Rangan |
last post by:
Hi,
Has anybody worked on disabling postback event of button event in webforms.
As it does not have a property of autopostback how do we make it disable.
I tried few article but they have given example of disabling the button not
disabling postback event!!!
Thanks
|
by: Rich |
last post by:
Hello,
So I would like to disable a textbox on a vb.net form
without the text getting grayed out. In vb6 I could place
a textbox control on a frame control and disable the frame
leaving the textbox enabled and text/background were
intact but mouse cursor remained an arraw (as opposed to
an I for editable). I tried a Panel control on my .net
form since I could I guess there is no longer a frame
control (also tried a groupbox control)....
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |