Showing posts with label buttons. Show all posts
Showing posts with label buttons. Show all posts

Wednesday, March 28, 2012

AJAX UpdatePanel Refresh != Browser Refresh

Hey everyone. I've got a problem, I have a page that I want the data and buttons to refresh every 30 seconds. When I click the button, the data is recorded into a database and the button(s) are disabled until the next interval comes up. An interval is 5 mins even though the data will refresh every 30 seconds. That means that when the button is pushed, it should be disabled until the 5 min interval is up.

The problem I'm having is that even though my whole page is in the Update Panel, my buttons DO NOT re-enable after that 5 min interval, but my data labels DO. I have an indicator that changes at each 5 min interval and it is working, but my buttons are still disabled. I can refresh the page and the buttons are enabled...another thing is that after I press the button and it's disabled, I can refresh the page and the buttons still stay disabled as thy should until the next 5 min interval.

Is the entire Page_Load called on the AJAX Update Panel refresh? It doesn't seem like it since my code that enables/disables my buttons is not being called. Any ideas?

What is the full page refresh doing that the AJAX Update panel is not? I would just do a normal page refresh, but that looks bad and I'm also using the collapsable panels and the normal page refresh call would collapse all the panels. That would make the use of them, well, useless.

try call the update function of the updatepanel

<asp:UpdatePanel ID="Test" ...

code behind ... Test.Update()

if not then use javascript to set the buttons back to disabled = false;


The data refreshes fine still, but the buttons don't "reset."

Baseically, I have a function that is called for each button that looks in the database to see if a log has been made for this record. If there is not a log, the button is enabled, if there is a log, the button is disabled until the next interval. For some reason, my functions that check my buttons are not being called when the update panel is updated each 30 seconds. The functionality when the button is clicked works fine, but the buttons never enable again unless I hit the refresh in the browser to refresh the entire page.

I hope someone else has some suggestions as to what might be going on. Thanks!


Ok, here's the answer of why my "AJAX UpdatePanel Refresh != Browser Refresh"...

In my old version of the page, I have the default value of my buttons set to enabled. Each time the page refreshes, the default value is seen. In the AJAX update panel, the default value is not seen and therefore my buttons were not resetting to the default. My functions were assuming these would be enabled unless the log was found.

I hope this helps someone that might have the same problems in the future.

Ajax update panel and the drop down list

Hi all,

Im using the update panel but have got into a spot of bother.

I've used the update panel many times before with buttons, but this time i need to use an update panel so that when a drop down list has its index chasnged that certain panels are shown and certain panels are hidden.

The problem i'm encountering is that the page does the post back, ive tried various options and tried to find decent examples on the next but everything is either with a checkbox or using a button.

on my page.aspx.cs i have the

1protected void dropTaxCertType_SelectedIndexChanged(object s, EventArgs e) {23UpdateCertView();45//UpdatePanel1.Update();6}78protected void UpdateCertView() {910//SortedList answers = this.AnsweredQuestions;11//DropDownList ddl = (DropDownList)sender;12//answers[ddl.ToolTip] = ddl.SelectedValue;13//this.AnsweredQuestions = answers;1415if (dropTaxCertType.SelectedValue =="0") {16pnlCert.Visible =false;17pnlRefNo.Visible =false;18}19else if (dropTaxCertType.SelectedValue =="1000") {20pnlRefNo.Visible =true;21pnlCert.Visible =false;22}23else if (dropTaxCertType.SelectedValue =="n/a") {24pnlRefNo.Visible =false;25pnlCert.Visible =false;26}27else {28pnlCert.Visible =true;29pnlRefNo.Visible =false;30}3132//if (ScriptManager1.IsInAsyncPostBack ){33// string callbackString = Map1.CallbackResults.ToString()34// ScriptManager1.RegisterDataItem(Map1, callbackString)35//}36}
 
as you can see from the above code ive tried various optinos from seeing it on the web with no success.
At first i created my updatepanle and inserted the ddl into it, but i kept getting this javasript error saying ambigous match found.
 
so i put the ddl outside the update panel, but because i have the autopostback it keeps posting back like a normal page without
update panel, but if i take out the autopostback the panls that are supposed to change dont. 
 
<table class="tLayout5"><tr class="top"><td colspan="2"><br /><hr /><br /><br /><strong>CIS Tax Certificate Type:</strong><br /><asp:DropDownList ID="dropTaxCertType" OnSelectedIndexChanged="dropTaxCertType_SelectedIndexChanged" AutoPostBack="true" CssClass="frmWidth99" runat="server"><asp:ListItem Text="" Value="0"></asp:ListItem><asp:ListItem Text="Subcontractor Certifying Document" Value="1000"></asp:ListItem><asp:ListItem Text="CIS4 - Registration card - must pay net" Value="CIS4"></asp:ListItem><asp:ListItem Text="CIS5 - Corporate certificate - can pay gross" Value="CIS5"></asp:ListItem><asp:ListItem Text="CIS6 - Photocard certificate - can pay gross" Value="CIS6"></asp:ListItem><asp:ListItem Text="CIS65 - Temporary registration - must pay net" Value="CIS65"></asp:ListItem><asp:ListItem Text="Exempt or Non Applicable" Value="n/a"></asp:ListItem></asp:DropDownList><br /></td></tr></table><asp:UpdatePanel ID="UpdatePanel1" updatemode="conditional" runat="server"><ContentTemplate><asp:Panel ID="pnlRefNo" runat="server"><table class="tLayout5"><tr class="top"><td colspan="2"><label for="txtUniqueRefNo"><strong>Unique Reference Number:</strong></label><br /><asp:textbox id="txtUniqueRefNo" MaxLength="30" runat="server" CssClass="frmWidth99" /></td></tr></table></asp:Panel><asp:Panel ID="pnlCert" runat="server"><table class="tLayout5"><tr class="top"><td colspan="2"><label for="txtOtherTaxCertType"><strong>Other:</strong></label><br /><asp:textbox id="txtOtherTaxCertType" MaxLength="30" runat="server" CssClass="frmWidth99" /></td></tr><tr class="top"><td style="width:49%;"><label for="txtTaxCertNr"><strong>CIS Tax Certificate Number:</strong></label> <br /><asp:textbox id="txtTaxCertNr" MaxLength="50" runat="server" CssClass="frmWidth99" /><asp:RegularExpressionValidator ID="RegularExpressionValidator7" Enabled="true" ControlToValidate="txtTaxCertNr" Display="Dynamic" runat="server" Text="Invalid Number" ValidationExpression="\w{1,20}" /></td><td style="width:49%;"><label for="radDate_dateInput_TextBox"><strong>Expiry Date:</strong></label>(dd/mm/yyyy)<radcln:raddatepicker id="radDate" MinDate="1980-01-01" AllowEmpty="true" Runat="server"><PopupButton style="float: left" /><DateInput DisplayPromptChar="_" PromptChar=" " onclick="ToggleStartDatePopup()" Width="100px" style="float: left" /></radcln:raddatepicker><asp:RequiredFieldValidator runat="server" ID="rfvDate" ControlToValidate="radDate" InitialValue="1980-01-01" Text="Required!" /><br /></td></tr></table></asp:Panel><Triggers> <asp:AsyncPostBackTrigger ControlID="dropTaxCertType" /> </Triggers></ContentTemplate></asp:UpdatePanel>
 I hope someone can help me pleaseeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
 
many thanxz in advance
 
Zal
 
 
 
Try with the triggers tags outside the contentTemplate tags.

I've tried your code without this lines:

<radcln:raddatepicker id="radDate" MinDate="1980-01-01" AllowEmpty="true" Runat="server">
<PopupButton style="float: left" />
<DateInput DisplayPromptChar="_" PromptChar=" " onclick="ToggleStartDatePopup()" Width="100px" style="float: left" />
</radcln:raddatepicker>
<asp:RequiredFieldValidator runat="server" ID="rfvDate" ControlToValidate="radDate" InitialValue="1980-01-01" Text="Required!" />

with DropDownList inside UpdatePanel, and works fine.


That was probably because you aren't using the RadCalendar when you tried that code or it wasn't set up the same. The drop down wasn't triggering the update outside the update panel because the trigger tags need to be at the same level at the content template tags, not nested.

Saturday, March 24, 2012

AJAX Tabs button click event is not working

Hi there,

I am use AJAX Tabs control and placed a quite few buttons in each tab panel.

But when I run the from its change the tabs but when I am trying click the buttons inside the tab panels it is not woring. just stand still. no event being save,reset, redirecting.

I have even tried to put whole tab container into updatepanel and write is postback triger to that buttons but that also it not worked.

Is any one have some suggestion post it...

can u post your code..


Hi Geek,

Kindly find the code below in which when I am try to click the button which is placed inside the tab panel it is not working.

<cc1:TabContainerID="TabContainer2"runat="server">

<cc1:TabPanelID="TabPanel4"runat="server">

<HeaderTemplate>Home

</HeaderTemplate>

<ContentTemplate>

<asp:TextBoxID="date1"runat="server"></asp:TextBox><cc1:CalendarExtenderID="CalendarExtender5"

runat="server"TargetControlID="date1">

</cc1:CalendarExtender>

<asp:ButtonID="Button1"runat="server"Text="Button"/>

</ContentTemplate>

</cc1:TabPanel>

</cc1:TabContainer>

what I was trying is when he select that date & click on the date selected I have the data in database which I have to show in grid...

Just have a hands on it if you find any thing.

just post it...


You are not written the Click event of button, so it was not working..

if i select the date and press on the button , it will give me the selected date, now then you can do any operations that you want..

Wednesday, March 21, 2012

Ajax TabControl and validation are incompatible - any way to resolve

Hi -

I've found out that the buttons in my tab panels no longer post back when I add validation on the input form. Is there a way around this? Has anyone solved this?

Thanks for ANY help or idea how to tackle ...

Oliver

Each tab have their own buttons? if this is a case use ValidationGroup. e.g: in tab1 assign to ValidationGroup property in your validation controls and button controls to say tab1, in tab2 assign a validationgroup property of say tab2 and so on.


the content of each tab are in a user control ... I thought that would take care of it, ... thanks for the pointer