Showing posts with label box. Show all posts
Showing posts with label box. Show all posts

Wednesday, March 28, 2012

Transparent Popcontrol extender problems

Hi, I am having an odd problem. I have about the simplest test case of a popupcontrol exenter I can think of below. I added a combo box below the extended textbox to illustrate the problem. The issue is that when I click on the textbox to display the radiobutton list, the back ground of the radion button list is transparent. How come? It doesn't matter what control is underneath the textbox. The radiobutton list is always displayed with a transparent background. What is the magic dust I am missing?

Thanks ... Ed

<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<br />
<asp:TextBox ID="textbox1" runat="server" Width="200"></asp:TextBox><br />
<asp:DropDownList ID="DropDownList1" runat="server" Width="216px">
<asp:ListItem>Item1</asp:ListItem>
<asp:ListItem>Item 2</asp:ListItem>
</asp:DropDownList>
<ajaxToolkit:PopupControlExtender ID="PopupControlExtender1" runat="server" CommitProperty="value"
CommitScript="e.value += ' - do not forget!';" PopupControlID="Panel1" Position="Bottom"
TargetControlID="textbox1">
</ajaxToolkit:PopupControlExtender>

</div>
<asp:Panel ID="Panel1" runat="server" >
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
<asp:ListItem Text="Walk dog"></asp:ListItem>
<asp:ListItem Text="Feed dog"></asp:ListItem>
<asp:ListItem Text="Feed cat"></asp:ListItem>
<asp:ListItem Text="Feed fish"></asp:ListItem>
<asp:ListItem Text="Cancel" Value=""></asp:ListItem>
</asp:RadioButtonList>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
</form>

The default value of background-color style is transparent, so you will get transparent radio button lists. You can specify a color explicitly to make this work.

Thanks so much. That was it. Although it raises a question. I set the background color of the underlying panel to white. How come the what was under the panel showed through the panel and through the radiobuttonlist?

Thanks ... Ed

Trapping server errors

If an asynchronous call generates an error on the server side, the client displays a Javascript alert box with the basic error message, for instance "Object reference not set to an instance of an object".

Is there any mechanism to trap and react to these errors on the client side, for instance directing them to an error page instead of showing them the alert box?

Mike

You can set in web.config

<customErrors mode="RemoteOnly" defaultRedirect="GenericError.aspx">
</customErrors>

So that client side will be rredirected to GenericError.aspx instead of getting an error...


I think you misunderstand the question. These are server side errors that occur on an AJAX asynchronous postback, rather than a regular postback, so it is not possible to redirect the client by using either the built in ASP.NET custom error page functionality, or by using Response.Redirect.

There must be some mechanism within the AJAX library for me to specify what to do in the case of an exception being raised. Really, all I want to do is, instead of the alert box showing the .NET error message, it should show something generic like "Oops, an error occured".

Can someone tell me how I do this?

Mike


Check this example, might be useful for you .

http://ajax.asp.net/docs/ViewSample.aspx?sref=Sys.Net.ErrorHandlingTutorial%23WebServiceMethodError.aspx

http://ajax.asp.net/docs/tutorials/ConsumingWebServicesWithAJAXTutorial.aspx

Saturday, March 24, 2012

Trigger stops working after first postback

Hi,

First let me explain the basic situation. I have a page with 2 list boxes (there are more, but for the sake of argument, take 2). The Box A contains a list of items. The Box B contains the list of items chosen by the user. There is an imagebutton that when clicked, moves the selected ListItem from Box A to Box B, and there is another imagebutton that moves a selected item from Box B to Box A.

Pretty straightforward. The list boxes are in separate update panels because they each have other triggers associated with them that are not common to the other. Here is what happens, when the move button is clicked the first time, the transfer works. After that, it's as if there is no postback at all.

Here is how I have it setup:

<

atlas:UpdatePanelID="LeftColPanel"runat="server"Mode="Conditional">
<ContentTemplate>
<asp:ListBoxID="LeftCol"runat="server"Rows="10"Width="140"/>
</ContentTemplate>
<Triggers>
<atlas:ControlEventTriggerControlID="MoveToLeftCol"EventName="Click"/>
</Triggers>

<

asp:ImageButtonID="MoveToLeftCol"runat="server"ImageUrl="pics/left.gif"OnClick="MoveToLeft"/>

and similarly for the second List Box.

What I don't understand is why it works the first time, and not after that? Any help would be appreciated.

Thanks,

i also have the same problem with a gridview
i don't know the solution yet but do you have some strange character in your listbox?
like single quote, or something else

or maybe you already found the solution :)

if yes please let me know

thanks

Trigger UpdatePanel with javascript

I have a GridView inside an UpdatePanel. Also on the page is a button, that when the user clicks opens up a modal dialog box. After the user selects an item from the dialog box, the dialog closes which triggers a javascript function. The purpose of this javascript function is to re-bind the GridView, thereby displaying the item just selected from the dialog box.

The javascript function simply triggers a hidden linkbutton that also resides inside the UpdatePanel.

The javascript code:

document.getElementById('ctl00_Main_LinkButton1').click();

The LinkButton code:

ProtectedSub LinkButton1_Click(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles LinkButton1.Click

GridView1.DataBind()

EndSub

This all works fine under IE6. The problem just started when I upgraded to IE7. The LinkButton is no longer getting triggered, so the GridView doesn't update. I've tried this with both the Atlas release, and the Ajax Beta 2 release. Neither seems to do what I want with IE7.

One other thing, if I remove the UpdatePanel from the page entirely, and force a full page refresh, it works fine with IE7.

Has anyone else noticed this? Any ideas on a work around?

hello.

try using fiddler to see the error you're getting.


I downloaded and ran Fiddler, but can see no errors.

I have many apps that use the similar method, and it works in IE6, IE7 and Firefox v2.0 and Apple Browser (don't remember the name - Safari?) hmmm who cares.

Try put your LinkButton outside the update panel.

WS

p.s: my apps use button instead link button. AND I don't use modal window, because it's not supported by many browsers. Instead, I use floating div. Good Luck.


I think the key difference with your solution is that all the logic resides in one page (with the use of floating div). I have tried adding a linkbutton outside the updatepanel, but this makes no difference in my solution.

With the modal dialog, I can trigger the javascript function when the dialog is closed. I tested this my triggering an Alert from my javascript function, so I know the function is being called when I close the dialog.

I next tried adding an HTML Input button outside the updatepanel:

<inputid="Button1"type="button"value="button"onclick="javascript:document.getElementById('LinkButton1').click();"/>

When I clicked this button, itdid trigger a refresh. I'm just not sure why it won't do it automatically once the dialog box is closed. Again, I've proven that the function is being called when the dialog is closed. I'm wondering if this isn't some IE 7 security issue. I've played around with the permissions a bit, but still have no joy.


For what it's worth,

I finally found a solution to my problem. I did a little digging into the JS file for the AJAX ModalPopup control, and modified my javascript accordingly:

window.setTimeout(

"document.getElementById('ctl00_Main_LinkButton1').click();", 0);

Now works with both IE6 and IE7.

Thanks to all for your responses.

Triggering PopupControlExtender from button click

I've got a simple scenario: I'm using a text box with a PopupControlExtender to display a calendar. Works great, but not the most intuitive way to bring up the calendar. I'd like to add an image button to the right of the text box that could ALSO trigger the opening of the calendar, in addition to the normal click on the text box.

I've tried using a call to this as the OnClientClick property, but nothing happens:

function OnButtonClick(){ var behavior = $find('pce'); behavior.showPopup();}

I'd appreciate any assistance on what seems like itshould beso obvious!

-- Jim --

what about using the AJAX toolkit's built-in calendar extender?

Triggering partial update on text box losing focus

Hi,

I have a form on which I want a user to be able to enter a post code and, when the user tabs out of the field, triggers the population of a drop down list which contains the suburbs the postcode relates to, so the user can then select the suburb.

I have the drop down list in an Update Panel with partial rendering turned on but I can't figure out how to trigger it being refreshed when the control loses focus. I think I need to link it to the OnBlur event using javascript but I'm stuck at that point. Any ideas appreciated...

Thanks,

SimonOK, it was me being dippy. I didn't need to get clever and start hooking client side events, I just needed to set the Render property to "Always" and it fires whenever the text box loses focus.

S