Showing posts with label imagebutton. Show all posts
Showing posts with label imagebutton. Show all posts

Wednesday, March 28, 2012

calling a server side method to rebind and refresh a datalist in updatepanel without a ful

I have 2 datalists:

datalist1 (inside UpdatePanel1)

datalist2 (outside UpdatePanel1)

I have a ImageButton inside the datalist2 & when it is clicked, in the datalist2_ItemCommand event, I am updating some information in the database & calling a DataBind() on datalist1 & then calling an Update() method of UpdatePanel1.

This works fine, but my problem is that because of the datalist2_ItemCommand getting fired, a full postback occurs as well. How do I avoid this? I just want the datalist1 to be refreshed inside the UpdatePanel & not refresh the datalist2 at all.

If I use Web Service method, then I can do the database update in it, but I am unable to access the datalist1 to rebind it and also the UpdatePanel1 to update it.

Can someone please help me.

Thanks

Hi,

You canregister theItemCommand event ofdatalist2as a trigger of the UpdatePanel in whichdatalist1 is contained.

<Triggers>
<asp:AsyncPostBackTrigger ControlID="DataList1" EventName="ItemCommand" />
</Triggers>

Best Regards,


I had logged this issue in another forum my mistake and it got moved in this forum only after I logged it again as a new post (link below):

http://forums.asp.net/p/1180380/2000803.aspx#2000803

Thanks for your help.

Wednesday, March 21, 2012

CalendarExtender with ImageButton problem........

In this application,when you press the ImageButton ,the calenda will show; when you press the ImageButton again or select a date ,the calenda will disappear..

But what I wanna realize is that ,when you click the rest of the page ,the calenda will also disappear, how to realize that??

Thank you very much!!!!!!!!!

Default.aspx

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<link href="http://links.10026.com/?link=StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<br /><br />
<b>Calendar with associated button:</b><br />
<asp:TextBox ID="Date3" runat="server"></asp:TextBox>
<asp:Image ID="Image1" runat="server" ImageUrl="~/Calendar_scheduleHS.png" />
<ajaxToolkit:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="Date3" PopupButtonID="Image1">
</ajaxToolkit:CalendarExtender>

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

Hi liuyan,

This is an issue of the Ajax Control Toolkit that is known for a while now.

It is even something that will be fixed in an upcoming release of the Toolkit.

You should check the website. This is a direct link to the Issue you talk about.http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=7571

Look at the comments on that site: They include a workaround for this issue until it is fixed in the upcoming release.

Hope this helps!
Kind regards,
Wim


Hi liuyan,

For you situation, I think the easiest way is when hide the Calendar manually when OnClientDateSelectionChanged event occurs. Here is the sample you can refer to:

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1"
Format="yyyy-MM-dd" PopupButtonID="Button1"OnClientDateSelectionChanged="function hideCalendar(calendar) { calendar.hide(); }">
</ajaxToolkit:CalendarExtender>
<asp:Button ID="Button1" runat="server" Text="Calendar" />

I hope this help

Best regards,

Jonathan

CalendarExtender with ImageButton

Hi,

today i play around the sample of the CalendarExtender from the live demo page,

the third example is using the CalendarExtender with the imageButton,

when i click on the imageButton at the first time, the calendar is popup, then i simple select the date, click on it, the date was selected, fine.

but, when i trying to open the calendar popup, and choose nothing but click again on the imageButton,

the page was fully postback and my previous selected date on the textbox was gone.

at the end i got to solve this with no using the image button but normal image tag.

is that consider a bug?

or i missed something?

I have also discovered that the second click on the image button will force a postback.

I fixed it in the CalendarBehavior.js file like this:

In the _button_onclick function there is an 'if' statment thus

if (!this._isOpen) {
e.preventDefault();
e.stopPropagation();
if (this._enabled)
this.show();
} else {
this.hide();
}

I moved the event function invocations out of the 'if' statement like this:


e.preventDefault();
e.stopPropagation();

if (!this._isOpen) {
if (this._enabled)
this.show();
} else {
this.hide();
}

This seems to work for me on both IE and Firefox. Note that I haven't tested it fully though.

CalendarExtender Pops up below DropDownList - need help

Hi, I've used CalendarExtender with a TextBox. In the next row I had a dropdownList. Now, when I click the imagebutton, the Calender pops-up below the DropDownList.

Can any one help me with this?

Hi,

Please refer to this post: http://forums.asp.net/p/834115/834115.aspx#834115