Showing posts with label disabled. Show all posts
Showing posts with label disabled. Show all posts

Saturday, March 24, 2012

Dropdowns inside updatepanel flash on postback.

I have 2 dropdown controls inside an updatepanel. One is disabled or enabled dependent on the selection of the other dropdown. The disabled one has its autopostback property set to false. The other one has autopostback=true. When I make selection in dropdown 1, both dropdowns flash. Is there a way to prevent the redrawing of the controls and just have the data in them update?

Thanks,

John

Put the both the DropDownlist control in to its own UpdatePanel.And make the second updatepanel Updatemode ="Conditional" and when you want to second DDL to be enable do it in the code and call the update() method in the UpdatePanel two ..

refer the following link for more information

http://asp.net/ajax/documentation/live/overview/UpdatePanelOverview.aspx

Wednesday, March 21, 2012

DropDownList becomes disabled during asynch postback

The basic issue I find on my asynch postback is that two of myDropDownList controls becomes disabled during asynch postback. Once thepostback has completed I get access again to the DropDownList.

Nowmy two DropDown are in fact located within the UpdatePanel control, sonaturally it has something to do with that. Maybe its theautopostbacl=true property ?

Here are some details of my aspx Master page :

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1"runat="server"></asp:ScriptManager> <!-- note:ScriptMngr/Timer must be within form tag -->

<asp:Timer ID="TimerOrders" runat="server" Interval="5000" />
<div >
<asp:UpdatePanel ID="UpdateTally" runat="server" >
<ContentTemplate>


<asp:DropDownList ID="drpFilterList"DataSourceID="ObjectDataSourceFilterList" DataValueField="filter_id"DataTextField="f_name" AppendDataBoundItems="true" runat="server"Width="81px" AutoPostBack="True"OnSelectedIndexChanged="drpFilterList_SelectedIndexChanged"EnableViewState="true" >
<asp:ListItem Selected="True" Text="Default" Value="0" />
</asp:DropDownList>

<asp:DropDownList ID="DrpStatusList"DataSourceID="ObjectDataSourceStatusList" MaxLength="30" Width="110px"AutoPostBack="True" DataTextField="status" DataValueField="status"AppendDataBoundItems="true" runat="server"OnSelectedIndexChanged="DrpStatusList_SelectedIndexChanged" >
<asp:ListItem Value="0" Selected="true">All</asp:ListItem>
<asp:ListItem Value="LiveOrders"Selected="False">LiveOrders</asp:ListItem>
</asp:DropDownList>

</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TimerOrders"EventName=""/>
</Triggers>

</asp:UpdatePanel

I am facing a similar issue. Please do let me know if you find a solution!!!


Hi,robertmazzo

I test it with this demo,It works,I don't have your problem:

<%@. Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

protected void drpFilterList_SelectedIndexChanged(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
Label1.Text = ((DropDownList)sender).SelectedItem.Value + "--" + DateTime.Now.ToString();
}

protected void DrpStatusList_SelectedIndexChanged(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
Label1.Text = ((DropDownList)sender).SelectedItem.Value + "--" + DateTime.Now.ToString();
}

protected void TimerOrders_Tick(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
Label1.Text = DateTime.Now.ToString();
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Timer ID="TimerOrders" runat="server" Interval="5000" OnTick="TimerOrders_Tick" />
<div>
<asp:UpdatePanel ID="UpdateTally" runat="server">
<ContentTemplate>
<asp:DropDownList ID="drpFilterList" runat="server" Width="81px" AutoPostBack="True" OnSelectedIndexChanged="drpFilterList_SelectedIndexChanged" EnableViewState="true">
<asp:ListItem Selected="True" Text="Default" Value="0" />
<asp:ListItem Value="test" Selected="False">test</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:DropDownList ID="DrpStatusList" Width="110px" AutoPostBack="True" runat="server" OnSelectedIndexChanged="DrpStatusList_SelectedIndexChanged" EnableViewState="true">
<asp:ListItem Value="0" Selected="true">All</asp:ListItem>
<asp:ListItem Value="LiveOrders" Selected="False">LiveOrders</asp:ListItem>
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TimerOrders" />
</Triggers>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

Let me know if you need more info.

If this help you,don't forget mark it as a answer.Thanks!


Thanks for testing. I actually copied your page into a brand new page in my project and I face a similiar issue.

Ifyou select one of the DropDowns to display the list and keep your mousein place without clicking, then you should see the DropDown reset. Atthat point you need to reselect the DropDown with the mouse in order tosee the list again.

Inmy specific case (perhaps it has to dowith my master page) , the dropdown list sometimes remains displayedwhen I clickbut I cannot actually select a value for a couple of seconds. At timesI also notice that the DropDown values are cleared and I have toreselect the list (as previously mentioned).

I know users are going to complain about this because my inhouse QA tester is already noticing it.

Thank you again,

Bob


If you select one of the DropDowns to display the list and keep your mouse in place without clicking, then you should see the DropDown reset. At that point you need to reselect the DropDown with the mouse in order to see the list again. ?????

I do it just now! Haven't your problem!

You may update your IE to 7.0?


ThanksJin-Yu Yin - MSFT , your code working perfectly..

I also have IE 7


Is this is a known issue in IE6??


Okay, all you need to really do is suggest that I check myversion of IE. All the extra "?" and "!" characters are really notnecessary.

I actually have IE 7.0 on my machine. I'll test it somewhere else.

thank you for helping.

Bob


If you have time please copy this code onto your machine.

<>Here's my aspx code for Default2.aspx :

<%@. Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %
<!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 runat="server">
<title>THIS IS ONLY A DROPDOWNLIST TEST PAGE !!!</title>
</head>
<body>
<form id="form1" runat="server">

<asp:ScriptManagerID="ScriptManager1" runat="server"/>
<asp:TimerID="TimerOrders" runat="server" Interval="4000"OnTick="TimerOrders_Tick" />

<div
<asp:UpdatePanel ID="UpdateTally" runat="server">
<ContentTemplate>
<asp:DropDownList ID="drpFilterList" runat="server" Width="81px"AutoPostBack="True"OnSelectedIndexChanged="drpFilterList_SelectedIndexChanged"EnableViewState="true">
<asp:ListItem Selected="True" Text="Default" Value="0" />
<asp:ListItem Value="test"Selected="False">test</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="Label1" runat="server"Text="Label"></asp:Label>
<asp:DropDownList ID="DrpStatusList" Width="110px"AutoPostBack="True" runat="server"OnSelectedIndexChanged="DrpStatusList_SelectedIndexChanged"EnableViewState="true">
<asp:ListItem Value="0" Selected="true">All</asp:ListItem>
<asp:ListItem Value="LiveOrders"Selected="False">LiveOrders</asp:ListItem>
<asp:ListItem Value="New Order" >New Order</asp:ListItem>
<asp:ListItem Value="Cancelled">Cancelled</asp:ListItem>
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TimerOrders" />
</Triggers>
</asp:UpdatePanel>

</div>
</form>
</body>
</html>

Here's the .aspx.cs code :

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}

protected void drpFilterList_SelectedIndexChanged(object sender, EventArgs e)
{
//System.Threading.Thread.Sleep(3000);
Label1.Text =((DropDownList)sender).SelectedItem.Value + "--" +DateTime.Now.ToString();
}

protected void DrpStatusList_SelectedIndexChanged(object sender, EventArgs e)
{
//System.Threading.Thread.Sleep(3000);
Label1.Text =((DropDownList)sender).SelectedItem.Value + "--" +DateTime.Now.ToString();
}

protected void TimerOrders_Tick(object sender, EventArgs e)
{
//System.Threading.Thread.Sleep(3000);
Label1.Text = DateTime.Now.ToString();
}
}

--------------------------

dropdownlist and server side validation control

Hi

I have a dropdownlist and it has a required field validator inside an updatepanel. Validation is done on server side and client side is disabled.
I have other controls with required field validations (server side only) and is NOT inside update panel.

The issue is when i select an item in dropdownlist it does a partial postback and validation is performed and the error message next to the dropdownlist will disappear. But for the other controls though the user fills in the data, the error message will only disappear on full postback on submit button click. This might be confusing for the user.

How can i make it work to have a standard error message display ONLY ON submit button click for all controls (including the partial postback controls inside updatepanel) ?

Is there any way i can do other than,
1. validation summary on top/bottom of the page.
2. Taking validation control outside update panel. If i have more than 10 controls, then i need to add more than 10 update panel and html table structures etc. etc.

Any ideas?

Thanks
Ganesh K

Validators are not compatibale with ASP.NET AJAX 1.0

http://weblogs.asp.net/scottgu/archive/2007/01/25/links-to-asp-net-ajax-1-0-resources-and-answers-to-some-common-questions.aspx

You can download another version of validators from here

http://blogs.msdn.com/mattgi/archive/2007/01/23/asp-net-ajax-validators.aspx

DropDownExtender problem

Hi all...

I have problem with DropDownExtender.

There is on the page have placed DropDownExtender and disabled TextBox Control with some text.

When I make right click on the text in disabled textbox, I get JavaScript error like "Object doesn't support this property or method". (Problem with getClientRects function in Script sources file)

Simple content page:

<%@dotnet.itags.org. Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestApp.Default" Title="Untitled Page" %><%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><asp:Content ID="Content1" ContentPlaceHolderID="cphContent" runat="server"><table cellpadding="0" cellspacing="0" border="0"> <tr> <td align="left"> <asp:Label ID="lblLinkName" runat="server" Font-Size="12px" Text="Show Links" Style="display: block; padding: 2px; padding-right: 20px; color: White;font-size:12px;font-weight:700;font-family: Verdana,Arial, MS Sans Serif, Tahoma;" /> <asp:Panel ID="DropPanel" runat="server" Style="display: none; visibility: hidden; background: White;"> <table cellpadding="2" cellspacing="0" border="0" style="width:150px; border: solid 1px Gray;"> <tr> <td><asp:LinkButton ID="lnkFirst" runat="server" Text="First Link" /></td> </tr> <tr> <td><asp:LinkButton ID="lnkSecond" runat="server" Text="Second Link" /></td> </tr> <tr> <td><asp:LinkButton ID="LinkThird" runat="server" Text="Third Link" /></td> </tr> </table> </asp:Panel> <ajaxToolkit:DropDownExtender runat="server" ID="DDE" TargetControlID="lblLinkName" DropDownControlID="DropPanel" HighlightBackColor="#256294" HighlightBorderColor="white" /> </td> </tr> <tr> <td> </td> </tr> <tr> <td><asp:TextBox ID="txtField" runat="server" Width="200" /></td> </tr></table></asp:Content>
 CodeBehind:
 
using System;using System.Data;using System.Configuration;using System.Collections;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;namespace TestApp{public partialclass Default : System.Web.UI.Page {protected void Page_Load(object sender, EventArgs e) {if (!Page.IsPostBack) { txtField.Text ="Hello World!"; txtField.Enabled =false; } } }}

Try to reproduse this bug or leave your email and I send example.

Please help.Sad