Showing posts with label enabled. Show all posts
Showing posts with label enabled. Show all posts

Wednesday, March 28, 2012

Dynamic generated Controls doesnt work, javascript error

I have an ajax enabled control which has a Dropdownlist that changes the Textbox when index gets changed. It is working fine if I use an ASPX page that contains the control in design time.

However, when I dynamically add this control to the ASPX in run time, I got an error when the Dropdownlist is triggered:

Javascript error: System.InvalidOperationException: A control with ID 'myDropDownList' could not be found for the trigger in UpdatePanel..etc..

What should I do? Please help..

There's a good chance that if you look at your page source you'll find that the dynamic control does not have a clientside Id of 'myDropDownList'. It'll probably have something more complex like ct100_myDropDownList or something.

Two possible fixes: 1) wire up your javascript on something other than the id (e.g. iterate over getElementsByTagName), or 2) render the control's ClientID inside a script tag on the page like: var ddl = '<%= myDropDownList.ClientID %>'

HOpe that helps.

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

DropDownExtender cannot work correctly in IE6 and Firefox 2.0. Theme cannot change in Fire

Hi there,
A week later, I begin develop a new shop cart application with Ajax enabled.
My problem is:
1. My Page option feature (to change site's theme) is put in a panel with a DropDownExtender.
It cannot show/hide correctly:
- In Internet Explorer 6.0, italway show a "area" at top or bottom in the page.
Click on darkblue and pink icon still can change page skin.
- In Firefox browser, my application hide/show "area" correctly. But, when click on any icon
(an asp:ImageButton), after a postback,page's theme doesn't change.
- In Opera, and IE 7, everything is fine.

Please help me.
This is my demo site url:
http://ajaxshop-1.at.vwdhosting.net/
"Page option" in my language is: "Tùy ch?n trang" - under the search bar.

My source code:

1/*2* This is my user control aspx code3*/4"C#" AutoEventWireup="true" CodeFile="SelectTheme.ascx.cs" Inherits="UserControls_SelectTheme" %>5"AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>6

"right">7

class="PageOptionTextStyle">8 "HyperLinkPageOption" runat="server" Text="Tùy ch?n trang "9 Width="100px">10 "DropDownExtender1" runat="server" DropDownControlID="PanelPageOption"11 TargetControlID="HyperLinkPageOption" HighlightBorderColor="transparent" >1213 "PanelPageOption" runat="server" Width="100px">14

"vertical-align:middle;text-align:center; background-color:LightYellow; height:20px; border-right: gray 1px ridge; border-top: gray 1px ridge; border-left: gray 1px ridge; border-bottom: gray 1px ridge;" align="left">15

16"middle" height="20px">17"middle">18class="innerlink"> Màu s?c: 19"ImageButtonDarkBlueSeclect" runat="server" SkinID="DarkblueSkinSelectButton" OnClick="ImageButtonDarkBlueSeclect_Click">20 21"ImageButtonDarkRedSelect" runat="server" SkinID="DarkredSkinSelectButton" OnClick="ImageButtonDarkRedSelect_Click">222324

2526

2728

29

303132/*33* This is code behind34*/35public partialclass UserControls_SelectTheme : System.Web.UI.UserControl36{37protected void Page_Load(object sender, EventArgs e)38 {3940 }41protected void ImageButtonDarkBlueSeclect_Click(object sender, ImageClickEventArgs e)42 {43 MySetTheme("Darkblue");44 }45protected void ImageButtonDarkRedSelect_Click(object sender, ImageClickEventArgs e)46 {47 MySetTheme("Darkred");48 }4950protected void MySetTheme(string themename)51 {52//Apply new theme53 Profile.CurrentTheme = themename;5455//Transfer to previous page56 Server.Transfer(Page.AppRelativeVirtualPath.ToString());57 }58}5960

Sorry, y writing "A week later, I begin developing a new shop cart application with Ajax enabled.
" i mean "A week before, I began develop a new shop cart application with Ajax enabled"

And, if you don't want to check my error in my web page, you can view this image

Error in IE6