Showing posts with label master. Show all posts
Showing posts with label master. Show all posts

Wednesday, March 28, 2012

Postback Page controls go reverse video

I'm using master pages, and have various content pages using the same paster page, with an update panel in my paster page, that wraps my content pages. All works very well.

However, on some content pages if I double click my rows in my Gridview to cause an edit of that record, all the controls on the page are reverse video for a brief second, this is only true on some content pages, not all. I've recreated one of the content pages in question from scratch, same issue.

Has anyone else ran into this reverse video issue before?

No,I have never ran into this issue before.So I'm afraid I donn't have any idea on it if you don't provide with a repro of it.

Regards

Postback sees TextChanged event while timer initiated the postback


Hi,

I have a challenge which I cannot seem to master and I hope that somebody already solved it.

Here is the setup to create the issue:

Place an updatepanel on a page, place a timer control inside (or outside with a trigger section for the panel), set the interval to 3000 or so and enable the timer.

Then place a TextBox on the page and add some code to the TextChanged event.

Now start the page..

Type some text in the textbox but don't press enter, when the timer fires you will find that the TextChanged event comes in through the postback.

I think I have tried everything, partialrendering to true, updatemode to conditional, childelementsastriggers to false and so on...

I need the text entered in the textbox to stay as it is until the moment the user presses enter, while the update panel constantly refreshes a datagrid.

Does anybody have a solution? Would I need to use a javascript timer which updates the datagrid? would that prevent a postback?

Please help...

Thanks

Is the textbox inside the updatepanel?

If your expecting the user to hit enter, presumably that triggers a click event for a button. Why not read/process the textbox's value as part of the button's click event and avoid TextChanged altogether?


Inside or outside renders the same problem.

The thing is that when a user enters some text in the textbox but is not finished typing yet, the timer causes a postback which in turn results in the TextChanged event, but the user is not ready to post yet.


Yeah i'd say this is by design and theres nothing you can do about it. Modify your approach so it doesn't make use of the TextChanged event (as i suggested in previous post).


If you can put the DataGrid and TextBox in separate UpdatePanels, that would begin to solve the problem.


Ha, I won't sacrefice design over some "feature". I won't believe that this behaviour is by design and if it is then there must be a way to intercept the event..

Hmm... I may have solved my own problem.

P.S. the TextChanged event is needed as we are using barcode scanners which add a carriage return to the end of the text stream which triggers the TextChanged event just nicely. The user should also be able to enter some code without hitting a button as confirmation..

Thanks,

Wouter


I'm not sure how multiple UpdatePanels would change your design, since you didn't post any sample code.

You may want to take a closer look at how UpdatePanels work. What you're describing is the inevitable consequence of putting a timer on an UpdatePanel that contains data entry fields.

PRB: Master Pages and Update Panels/Script Manager - AJAX Magic not working

I have a master page that has the script manager control and a content place holder

I have a content page that is using the above master page and with a gridview control wrapped in an update panel

When the content page doesn't use master pages and the script manager is placed within the content page along with the panel, everything works fine

The problem arises when the master page has the script manager and thhe content page just has the update panel with the gid view. It seems to be doing a regular postback and the ajax plumbing doesn't seemto have any effect..

I also tried adding a page initi handler and specifying the trigger in the code behind but with no luck..

generated page source with script manager in master page is listed below. Why does gettting a common master page scnario be so difficult to getv it working..Please point me in the right direction

<script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('_ctl0:ScriptManager1', document.getElementById('aspnetForm'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls(['t_ctl0:ContentPlaceHolder1:panel1'], [], [], 90);

//]]>
</script>


Genertated source when the script managersits on the page and the content page does not use any master pages

<script <script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('aspnetForm'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tpanel1'], [], [], 90);

//]]>
</script>

Hi Ajaxnewbie,

Could you please post your code, so we can see how you have implemented it. Thanks

Regards,


Good question... I have exactly the same problem. I wish there would be a valid answer for this post.

thanks!

Monday, March 26, 2012

Previous ViewState being used after UpdatePanel refresh

I am not sure its a problem with a viewstate--just a guess. The problem is this:

I have a page that uses a master page. It has two updatepanels in it. One updatepanel has a dropdownlist and one has a button and a label. When the button triggers a partial postback, I set the value of the label and can see it change on the page. When the dropdownlist triggers a partial postback the label switches back to its previous value right before the partial postback. When I inspect the value in the code behind for the dropdownlist the previous value is what is in the label.

What could be causing this? Has someone else had a similar problem? Where was the previous value even stored for it to be retrieved. Does each updatepanel have a viewstate?

Due to the complexity of my master page, I cannot put the dropdownlist, button and label in the same updatepanel. Is that the source of the problem?


There's one ViewState for the entire page, and it's updated during each async postback.

Could you boil this down to a small sample (e.g. a couple UpdatePanels, one with a DropDownList, one with a Label) and paste the code here?

Also, try removing the UpdatePanels (or setting EnablePartialRendering="false" on your ScriptManager) to see if this works with regular postbacks. That may help to figure out what's going wrong.


Also make sure each UpdatePanel's UpdateMode is set to conditional.

probably simple but i am new - Trying to do a partial render on a master page for my navi

I am trying to learn ajax and i got off to a fairly good start but i am stuck on this one and couldnt find any answers on the net.. i understand the use of a script manager and a updatepanel i got it to work on a page with a tree and when you select a item it loads a picture into a imgbox and it works great but here is my problem

I have a master page.. on the master page it contains my navi bar. each of the 4 buttons opens a new content page (*.aspx). I am trying to set it up so the Navi bar doesnt reload everytime i open another content page.. i want just the contentplace holder to refresh.. I have tried putting a updatepanel around my navi bar but it just doesnt seem to work.. i know this is probably really simple and i want to thank everyone in advance.

Thanks

-steve

I think you were on track when u put update panel over your menu. Just make sure that the update panel UpdateMode=Conditional

This way it will only cause postback when some trigger or other method will make it to cause postback.

Here are some good tutorial on UpdatePanel and update methods.

http://www.asp.net/learn/ajax-videos/video-177.aspx <-- this one talks about conditional mode

http://www.asp.net/learn/ajax-videos/video-159.aspx

http://www.asp.net/learn/ajax-videos/video-118.aspx

Also, you can do it other way around and place an Updatepanel in your Content Holder, and set it to update based on the menu selection. This way only parts your need actually be updated in content holder.


hello.

hum, i'm not following: you're opening a new content page but you want to do that without refreshing the page presented in the browser? if that is what you want, then the answer is: cannot be done. you'll have to refactor your site so that the content is loaded through user controls. if that is not what you meant with the previous mail, please give us more information.


Luis Abreu:

hello.

hum, i'm not following: you're opening a new content page but you want to do that without refreshing the page presented in the browser? if that is what you want, then the answer is: cannot be done. you'll have to refactor your site so that the content is loaded through user controls. if that is not what you meant with the previous mail, please give us more information.

Ok.. let me try to explain it better for you..

Files:

Masterpage.master
Home.aspx
contact.aspx
services.aspx
portfolio.aspx

So all of the pages above use Masterpage.master as the master page The master page is layed like this

Top Image
Navi Bar
ContentPlaceHolder
Bottom Image

so lets say we start out at home.aspx and we want to click on the contact img (on the master page) and it goes to contact.aspx
i want to do it in a way that instead of loading contact.aspx and reloading the content of the masterpage.. it only loads the contentplace holder..

I understand what your saying but what controls would i have to use.. or maybe i set up the image the way its linked wrong i used html.. here is the code maybe i should do it another way? Now you have me really thinking.. ill tinker with it more later today but i greatly appreciate your help.. thanks


hello again.

ok, then it's option 1. i think that in this case, you'd need to refactor your site so that it only has one page. you'd need to transform home, contact, services and protofolio pages in asp.net user controls which would be loaded when you click on the menu. I've written an old post that shows how to replace the contents of an updatepanel. it might help you get starting:

http://msmvps.com/blogs/luisabreu/archive/2007/02/15/adding-controls-to-an-updatepanel-through-code.aspx


hey Luis.. ok i started using ascx and everything works fine except for the fact that now when i load a ascx file into a contentplaceholder in a updatepanel the asptreeview that i now have as a webcontrol instead of a page wont work... any ideas? it wont let me expand anything..

Probblem with Menu control inside an update panel

Hi,

I have a master page with a script manager ,update panel and Content Palce Holder. in the default page which uses the masterpage I have added a menu control, textbox and a button. I have two problems which I have seen in the past in other versions of ajax. I have not coded anything other than just these controls on a page

1) I could click on button all day long and there is no java script error but as soon as I click on a menu item I get javascript error saying:

Line:221

Char:20

Error '0.cells' is null or not an object

code: 0

2) I can not get my CSS sheet work in my app theme for the background images. I have the following code in my CSS

.Menu1BackGround

{

background-image:url(/Images/Menu1_Background.bmp);

}

and I have assigned the it to the menu. Nothing happens as if it does not recognize the image path. I could add the background:black to the code and it works fine for the color but not the image. I am not sure if thisis because of the same problem.

Any body have any ideas?

Thanks

Seehttp://ajax.asp.net/docs/overview/UpdatePanelOverview.aspx#UpdatePanelCompatibleControls. The Menu control is not supported inside an UpdatePanel.

I have been using this piece of javascript to go around the menu problem:

var oldMenu_HideItems = Menu_HideItems;if(oldMenu_HideItems){Menu_HideItems = function(items){if (!items || ((typeof(items.tagName) =="undefined") && (items instanceof Event))) { items = __rootMenuItem; }if(items && items.rows && items.rows.length == 0){ items.insertRow(0); }return oldMenu_HideItems(items);} }
I got it from the asp:menu javascript code and I hook it to "patch" the problem.
Adding it to a page where a menu resides makes the javascript error go away. 

http://forums.asp.net/thread/1517884.aspx

HTH


Menu control is not compatable with AJAX.

I m also facing sme problem..

Wednesday, March 21, 2012

Problem in using validation in Multiple step Wizard in content place holder of master page

We have a master page with many content place holders. All placed in ATLAS update panel.

In Content page we are using wizard control and we want to do validation on each step of wizard. Problem is that one 1st step is successfully validated and user moves to 2nd step of wizard and after entering data clicks next button. Validation controls used in 1st steps are invoked and causes error.

Master Page

,,,,,,,

<atlas:UpdatePanelID="AP1"runat="server">

<ContentTemplate>

<

asp:ContentPlaceHolder> < /asp:ContentPlaceHolder>

</

ContentTemplate>

</atlas:UpdatePanel>

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

Content page

<

asp:Content runat="Server">

<

atlas:UpdatePanel > <ContentTemplate>

<

asp:Wizard >

<

WizardSteps>

<

asp:WizardStepStepType="start">

<

asp:TextBoxID="TxBx_Extension"runat="server"ValidationGroup="Step1"></asp:TextBox> <asp:RequiredFieldValidatorID="RFV_Extension"runat="server"Display="None" ControlToValidate="TxBx_Extension"ValidationGroup="Step1"ErrorMessage="Extension Required!"> </asp:RequiredFieldValidator> <asp:ValidationSummaryID="VS_Step1"ShowMessageBox="true" ShowSummary="false"runat="server"ValidationGroup="Step1"/>

</

asp:WizardStep>

</WizardSteps>

</asp:Wizard >

</ContentTemplate>

</atlas:UpdatePanel >

</asp:Content>

Hello, hey guys and guls listen i have found a bug in asp.net but i want to tell u people and check it if u really a true lover of .net so here u goes ...

No one replied to this message query and it took almost three days to debug so i have happy to find the reason but i want every to atleast read this so he may not get struck while when he or she is coding his or her program.

Try to make a master page and then add a content page now creat contentplaceholder in master page and write ajax or atlas script manager and updatepanel in master page and go to content page make a multi step wizard and try to includ validation in step (start) and then try not to use any validation control in the next (step/final)step, this page is going to give error and if u dont use any validation control in this step and suppose i dotn't need any validation in this step but i have to use it because else i can't proceed in the next step of my step by step program, why should i have to use validation control in next step when i dont need it.

Thanx for considering this too ;)... enjoy and don't worry because this happen when there are new things to discover ...... :D.


hello.

i'm sorry, but i didn't get it...can you build a demo project and send it to me?

thanks.


Luis Abreu:

hello.

i'm sorry, but i didn't get it...can you build a demo project and send it to me?

thanks.

I'm afraid I don't get it, either. I have a multi-step Wizard with validators on every page save the last one, in a Master Page setup, with an UpdatePanel around the content placeholder.


Err, sorry, I forgot to mention my setup works without a hitch.

ashfaqcool, can you give us a short and complete example of the issue you're running in to? The code for the master page and the content page would greatly help.


hello sir,

As u said that u have validators in each step of the wizard try to remove a validation in intermediate step e.g u have validation controls on first step and then on 2nd step i dont need any of the validation control then u want to proceed to last step then u will recieve an error when u press next on the 2nd step.

thanx for looking into this and i hope u got it.


here is the demo

make a master page with name MasterPage.master and past this code ...

MasterPage.master

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

<%@. Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>

<!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>Untitled Page</title>
</head>
<body>

<form id="form1" runat="server">

<atlas:ScriptManager ID="Script_manager" EnablePartialRendering=true runat="server"> </atlas:ScriptManager>

<div>
<atlas:UpdatePanel runat="server" ID="UpdatePanel_1">
<ContentTemplate>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
<asp:contentplaceholder id="ContentPlaceHolder2" runat="server">
</asp:contentplaceholder>
</ContentTemplate>
</atlas:UpdatePanel>
</div>
</form>
</body>
</html>

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

now make a content page with name default.aspx and paste the following code into it.

Default.aspx

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

<%@. Page Language="VB" MasterPageFile="MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

<asp:Wizard ID="Wizard_1" Width="50%" runat="server" DisplaySideBar="False">
<WizardSteps>
<asp:WizardStep ID="Step_1" StepType="Start" runat="server" >
Enter Name: <asp:TextBox ID="TxBx_1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="TxBx_1" ID="RFV_1" runat="server" Display="None" ErrorMessage="Name Required!" />

</asp:WizardStep>

<asp:WizardStep ID="Step_2" StepType="Step" runat="server" >
Enter Password: <asp:TextBox ID="TxBx_2" runat="server"></asp:TextBox>

<%--<asp:RequiredFieldValidator ControlToValidate="TxBx_2" ID="RequiredFieldValidator1" runat="server" Display="None" ErrorMessage="Password Required!" /> --%>


</asp:WizardStep>

<asp:WizardStep ID="Step_3" StepType="finish" runat="server" >
<asp:TextBox ID="TxBx_3" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="TxBx_3" ID="RFV_3" runat="server" Display="None" ErrorMessage="Text Required!" />
</asp:WizardStep>

</WizardSteps>
</asp:Wizard>
<asp:ValidationSummary ID="VS_2" DisplayMode=BulletList ShowSummary=false runat="server" ShowMessageBox=true />

</asp:Content>
----------------------------------------------
now if u want to remove to remove or u want to debug just enable the validator written in colourful line

(green colour) in the default.aspx code

thanx i think and hope that, that solves the confusion; thanx.


I tried your code and I'm not getting the behavior you described. I uncommented the second step's validator and everything works as it should: step one's validator works as it should and so do the others. With the second step's validator commented, the page still works as it should and the behavior you describe doesn't manifest itself.

What version of ASP.NET AJAX are you running? I am running Beta 2.


i am having ASP.NET ATLAS. so u having ASP.NET AJAX beta 2.0 i think u are running the latest version.so i will try the same version ok thanx.

Problem of ModalPopup

How can I make ModalPopup control work properly in Master /content page scenario, which master page contains more than one content place holder? here's my code:

<%

@dotnet.itags.org.PageLanguage="VB"MasterPageFile="~/MasterPage.master"AutoEventWireup="false"CodeFile="Default2.aspx.vb"Inherits="Default2"title="Untitled Page" %>

<%

@dotnet.itags.org.RegisterAssembly="AtlasControlToolkit"Namespace="AtlasControlToolkit"TagPrefix="atlasToolkit" %>

<

asp:ContentID="Content1"ContentPlaceHolderID="NavigationLinksPane"Runat="Server">

</

asp:Content>

<

asp:ContentID="Content2"ContentPlaceHolderID="Pane2"Runat="Server">

</

asp:Content>

<

asp:ContentID="Content3"ContentPlaceHolderID="Pane3"Runat="Server"><atlas:ScriptManagerID="Scriptmanager1"runat="server"></atlas:ScriptManager><scripttype="text/javascript">function onOk() {

alert(

event.srcElement.Name);

}

</script><asp:PanelID="GlobalChangeQuerySourcePopupPanel"runat="server"CssClass="modalPopup"style="display:none"><p><asp:LabelID="GlobalChangeQuerySourcePopupLabel"runat="server"Text="Please select a item from list"></asp:Label></p><br/><asp:ListBoxID="GlobalChangeQuerySourceListBox"runat="server"></asp:ListBox><br/><center><asp:ButtonID="OkButton"runat="server"Text="OK"></asp:Button><asp:ButtonID="CancelButton"runat="server"Text="Cancel"></asp:Button></center></asp:Panel><atlasToolkit:ModalPopupExtenderID="ModalPopupExtender"runat="server"><atlasToolkit:ModalPopupPropertiesTargetControlID="GlobalChangeQuerySourceButton"PopupControlID="GlobalChangeQuerySourcePopupPanel"BackgroundCssClass="modalBackground"DropShadow="true"OkControlID="OkButton"OnOkScript="onOk()"CancelControlID="CancelButton"/></atlasToolkit:ModalPopupExtender>

<

asp:ButtonID="GlobalChangeQuerySourceButton"Text="..."runat="server"/>

</

asp:Content>

<

asp:ContentID="Content4"ContentPlaceHolderID="PaneJS"Runat="Server">

</

asp:Content>

I've tested out that it works very well if there is only one content place holder in my master page.

Any help will be appreciated, Thanks very much in advance.

Tony

Just want to bring this one up to get some attention from you guys

Thanks a lot if you guys can help me out.

Tony


I am having the same problem . See the last few entries on threadhttp://forums.asp.net/2/1364885/ShowThread.aspx