Web Forms :: Disable Postback When Select Dropdownlist To Control Other Two Dropdownlist Value

Mar 25, 2011

I had use a combox to let user select staff name and then it will automatically retrive the responsible recommending officer and approving officer to display in other 2 dropdownlist.

my code works fine but when user select staff name each time, the page will reload once to refresh the dropdownlist.

user complaint and don't want the page reload every time, how can i disable the postback? I need to use ajax?

[Code]....

[Code]....

View 5 Replies


Similar Messages:

Forms Data Controls :: Dropdownlist Postback Always Select First Item?

Mar 24, 2010

I have 2 dropdownlist controls (ddl1 and ddl2). When I pick an item from ddl1, it will update ddl2. The problem is when I pick an item in ddl2, it always selects the first item in the list. Is it that the ddl2 autopostback causes the first ddl1 to reload and results the ddl2 to be refreshed also? Or I didn't set something correctly?

[Code]...

View 12 Replies

C# - Disable Or Enable 2nd Dropdownlist In Aspx Based On Selected Choice Of The 1st Dropdownlist Box

Apr 15, 2010

I am having a problem with disabling DropDownList based on the chice of 1st DropDownList, there is no post back occuring, and it is a template based web app here is the current code:

<script type="text/javascript">
$(function() { var dropDownList1 = $('#<%= ddlUserType.ClientID %>');
var dropDownList2 = $('#<%= ddlMember.ClientID %>'); dropDownList1.change(function(e) {
if ( jQuery("#ddlUserType").val() != "ETOC") dropDownList2.removeAttr('disabled'); e.preventDefault();
else
dropDownList2.removeAttr('enabled'); e.preventDefault(); }
} );
</script>

what is happening now is page is blank and if I remove the above code everything shows, where I am going wrong. here is the plain and final javascript code which worked:

<script language="javascript">
function CheckDropDownState(lstbox)
{
if (lstbox.selectedIndex == 3) { document.forms[0].ddlMember.disabled = 1; }
else { document.forms[0].ddlMember.disabled = 0; }
}
</script>

and thew .aspx code: <asp:dropdownlist id="ddlUserType" runat="server" onclick="CheckDropDownState(this);"></asp:dropdownlist>

View 2 Replies

Web Forms :: Use A Dropdownlist Control So That A User Can Select A Value

Jan 25, 2010

I want to use a dropdownlist control so that a user can select a value. My problem is, the text value can be very large. Is there any way to make the text to appear on more than one line? Or is there any AJAX or jquery solutions? I can use a gridview with a checkbox but my client really wants a dropdownlist.

View 3 Replies

Web Forms :: Unable To Get Dropdownlist Control Value At Postback?

Feb 23, 2010

I have 2 - DropdownList controls, which i am filling at severside when page loads. After the user selection in DropdownList1, i am changing the contents in DropdownList2 values. This validation (i.e. changing the contents of Dropdownlist2 values) am doing in Javascript Clientside. But on postback i am not getting the values in DropdownList2. When i say "DropdownList2.Items.Count;" getting "0". I tried to put the contents of DropdownList2 in ViewState on pageload. But i am getting Serialization error at runtime "Viewstate["PersistValues"] = DropdownList2;". I am using html input hidden control to pass the values from server side to clientside for my validation. Now, to meet this requirement i am Binding the DropdownList2 at postback again with first DropdownList1's selected index (This is repeat of logic which i have done in Clientside).

View 5 Replies

Web Forms :: How To Pass Selected Value Of DropdownList To A User Control On Postback

Feb 25, 2010

I need to create a user control which will be loaded according to the selected value of a dropdownlist. The Dropdownlist is not the part of Control. I want to pass the value of selected value of dropdonwlist to my user control and the user control will load according to the Value. For not postback it work fine. But when the page is postback, that is when i select a item form dorpdownlist, the user control is not loaded.

View 6 Replies

Web Forms :: Set Focus In Dropdownlist Control (option) Base On Select Query?

Feb 9, 2010

this is my table

dept Table
dept Id (primary key column)
dept Name
101
sales
102
admin

View 2 Replies

Data Controls :: Filter Gridview Using Checkboxlist Control Or Multi Select DropDownList Control

Apr 27, 2013

I have seen this tutorials, its very good.

[URL]..

How to apply the same tutorials for checkbox list control to filter the gridview instead of dropdown list.

View 1 Replies

Data Controls :: Disable Or Hide DropDownList Control Based On Condition In GridView

Dec 18, 2013

I am using a dropdownlist in a gridview which contains 3 valuesappleorangebanana

apple will be displayed as default valueif i select orange and banana the dropdownlist list should be disable or hidden but the selected value must be displayed

protected void btnsubmit_Click(object sender, EventArgs e)
{
foreach (GridViewRow gr in GridView1.Rows)
{

[Code].....

View 1 Replies

DropDownList Within Composite Control Is Losing Selected Value On Postback

Feb 23, 2010

I am building a composite server control that currently only has a TextBox and a DropDownList. Here is the code in all its foetal glory:

[Code]....

The control appears to work correctly across postbacks, that is until declarative values are set, e.g.:

<squee:Address runat="server" ID="a" Street="123 Fake St" State="VIC" />

After this, the text box continues to work correctly, but the _state member does not pick up the posted back values and instead just sticks to the declared value. I've checked the raw posted values in the Request object, and the new value for the list's UniqueID is there, but _state doesn't pick it up.

View 1 Replies

Web Forms :: Disable And Highlight Certain Items In DropDownList?

Aug 12, 2010

I would like to highlight (bold) and disable certain items in the dropdownlist for selection.

My dropdownlist is fed from a SQL table of countries e.g.

Europe
-UK
-FR
-DE
-AU

I need to heading "Europe" to be not selectable? the database has a column (selectable = 0) for those heading and I need to make them not selectable on the client side.

View 9 Replies

Web Forms :: Disable A Dropdownlist When A Checkbox Is Checked?

Jul 6, 2010

Is there a way to have a dropdownlist disabled if the user checks a checkbox? Is there a tutorial that you can point me to?

View 12 Replies

Web Forms :: Can DropDownList Selection Disable Another TextBox RequiredFieldValidator

Jul 21, 2010

Is there anyway to disable a textBox's validation(RequiredFieldValidator) base on the selection of dropDownList ?

View 5 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

Web Forms :: Select All Dropdownlist?

Feb 4, 2011

im working on Visual Studio 2010, and im making a .net web page. The final idea is to use filters by using dropdownlist. By now i have 3 dropdownlist in cascade. The first filters the second and so on. Then by a grid view i display the selected items, right now i need to add an item that allows me to select all the items in the dropdownlist so in the next filters i like i have selected all. My code filters everything but i cant add this item. I only work in asp .net, not in the code behind wich i think is #C if im not wrong... i have to add a button in each dropdown.

I have read others post and the say that i have to add this in the dropdown>> "appenddatabounditems="True" and this sql sentence

WHERE ([PROJID] = CASE WHEN @PROJID= -1 THEN [PROJID] ELSE @PROJID END)

but it doesnt work.

heres the code.

<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestingConnectionString %>"
SelectCommand="SELECT [PROJID] FROM [sxb_Proyectos] ORDER BY [PROJID]">
</asp:SqlDataSource>
<br />
<asp:Label ID="Label1" runat="server" Text="Proyecto"></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1" AppendDataBoundItems="true"
DataTextField="PROJID" DataValueField="PROJID">
<asp:ListItem Value="0"><Select an option></asp:ListItem>
<asp:ListItem Value="-1"><Select All></asp:ListItem>
</asp:DropDownList>
<br />
<br />
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:TestingConnectionString %>"
SelectCommand="SELECT DISTINCT Ax50_Empleados.emplid, Ax50_HorasRegistradas.EMPLID
FROM Ax50_Empleados
INNER JOIN Ax50_HorasRegistradas
ON Ax50_Empleados.emplid = Ax50_HorasRegistradas.EMPLID
where PROJID = @PROJID
ORDER BY Ax50_Empleados.emplid">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="PROJID" PropertyName="SelectedValue"/>
</SelectParameters>
</asp:SqlDataSource>
<asp:Label ID="Label2" runat="server" Text="Rut"></asp:Label>
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"
DataTextField="emplid" DataValueField="emplid">
</asp:DropDownList>
<br />
<br />
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:TestingConnectionString %>"
SelectCommand="SELECT DISTINCT sxb_Producto.Producto, Ax50_HorasRegistradas.LINEPROPERTYID
FROM sxb_Producto
INNER JOIN Ax50_HorasRegistradas
ON sxb_Producto.Producto = Ax50_HorasRegistradas.LINEPROPERTYID
where emplid = @emplid and PROJID = @PROJID
ORDER BY sxb_Producto.Producto">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList2" Name="emplid" PropertyName="SelectedValue"/>
<asp:ControlParameter ControlID="DropDownList1" Name="PROJID" PropertyName="SelectedValue"/>
</SelectParameters>
</asp:SqlDataSource>
<asp:Label ID="Label3" runat="server" Text="Producto"></asp:Label>
<asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource3"
DataTextField="Producto" DataValueField="Producto">
</asp:DropDownList>
<br />
<br />
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource4"
EmptyDataText="There are no data records to display.">
<Columns>
<asp:BoundField DataField="PROJID" HeaderText="PROJID"
SortExpression="PROJID" />
<asp:BoundField DataField="EMPLID" HeaderText="EMPLID"
SortExpression="EMPLID" />
<asp:BoundField DataField="LINEPROPERTYID" HeaderText="LINEPROPERTYID"
SortExpression="LINEPROPERTYID" />
<asp:BoundField DataField="QTY" HeaderText="QTY" SortExpression="QTY" />
<asp:BoundField DataField="TXT" HeaderText="TXT" SortExpression="TXT" />
<asp:BoundField DataField="TRANSDATE" HeaderText="TRANSDATE"
SortExpression="TRANSDATE" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource4" runat="server"
ConnectionString="<%$ ConnectionStrings:TestingConnectionString %>"
ProviderName="<%$ ConnectionStrings:TestingConnectionString.ProviderName %>"
SelectCommand="SELECT [PROJID], [EMPLID], [LINEPROPERTYID], [QTY], [TXT], [TRANSDATE], [TRANSSTATUS], [DIMENSION], [DIMENSION3_] FROM [Ax50_HorasRegistradas] where PROJID = @PROJID and emplid = @emplid">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList3" Name="Producto" PropertyName="SelectedValue"/>
<asp:ControlParameter ControlID="DropDownList1" Name="PROJID" PropertyName="SelectedValue"/>
<asp:ControlParameter ControlID="DropDownList2" Name="emplid" PropertyName="SelectedValue"/>
</SelectParameters>
</asp:SqlDataSource>
</form>

View 1 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 :: How To Select Multivalue From DropDownList

Jan 26, 2010

i have DropDownList with sql select commend

<asp:DropDownList ID="DropDownList1" runat="server"
DataSourceID="SqlDataSource_department" DataTextField="Department"
DataValueField="Department_No" AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource_department" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [Department_No], [Department], [Code] FROM [Departments]">
</asp:SqlDataSource>

in the behind code, i can get the value using "DropDownList1.SelectedItem.Value" for Department_No and "DropDownList1.SelectedItem.Text" for Department

but i want also get the selected value "Code"

View 6 Replies

Web Forms :: Select Theme From DropDownList?

Oct 11, 2010

Im pretty new and Im not sure what Im doing wrong here. Could anyone please take a look at my code an let me know what my problem is.

[Code]....

View 1 Replies

Forms Data Controls :: Disable DropDownList In A Gridview Row When In Edit Mode

May 12, 2010

I have the following code in a GridView...

[Code]....

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 :: DropDownList Not Keeping Last Value On PostBack?

Apr 6, 2010

This would be a simple one for me if I was binding this dynamically. I don't think it's necessary to have a code behind for only 4 or so values. Anyways here is my ddl.

[Code]....

The problem is that when a user selects a value and it postbacks my ddl resets to the first value. How do I prevent this?

View 8 Replies

Web Forms :: Five Dropdownlist - How To Avoid Postback

Aug 3, 2010

I have 5 dropdpwnlist in asp.net page.. the 5th dropdwpnlist will show data based on 4th dropdownlist. and 4th dropdwpnlist will show data based on 3rd dropdownlist. and 3rd dropdwpnlist will show data based on 2nd dropdownlist. and 2th dropdwpnlist will show data based on 1st dropdownlist... All dropdownlist has auto postback=true.. so it cause postaback each time.. i want to avoid postback coz it refresh all page again and again and shows data.. coz my aplication is in hosting server..

View 5 Replies

Web Forms :: How To Keep The Colour In Dropdownlist After Postback

Nov 12, 2010

I created a dropdwonlist and add colours to the items. But the colours will lose after the postback. After googled, I knew it is because the attributes specified for the dropdownlist were not saved in ViewState and also found the code to Overriding SaveViewState() and LoadViewState(object) from [URL]

But after I copy the code to my web application to create a new class, there are so many error massages. I have spend two days to find the solution, without much success.

View 12 Replies

Web Forms :: Reset DropDownList After PostBack

Apr 1, 2010

I have a situation where i want to postback and redirect the user to the diffterent page wherever the user selects something from dropdown list. If the user presses the back button the in the browser the dropdownlist should be in the default state. i have already tried this code

protected void ddl_SelectedIndexChanged(object sender,Eventargs e)
{
int selecteditem = int.Parse(ddl4.SelectedItem.Value.ToString());
ddl.ClearSelection(
ddl.Dispose();
//Even tried ddl.selectedindex = -1 ;
//dosome postback i.e redirecting the user depeneding upon the value in selecteditem
}

View 8 Replies

Web Forms :: Expand DropDownList After Postback?

Mar 1, 2011

I would like to expand dropdownlist after onfocus postback. There is some code that runs when OnFocus is fired off then it needs to stay expanded so the user can select an item from dropdownlist. Currently it expands and contracts real fast when user clicks the dropdownlist, then the user has to click it again to select an item.

View 2 Replies







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