Showing posts with label mode. Show all posts
Showing posts with label mode. Show all posts

Monday, March 26, 2012

Atlas Update Panel DropDownList

I have a dropdownlist which has around 2300 items and is placed inside an EditTemplate of a DetailsView.

When i change the mode to edit, the detailsview does not change the mode and no error is shown. It silently stops updating. If i have lesser number of items in the dropdown it works.

I have tested the controls outside the updatepanel to check if there is anything wrong with my code, but that works fine. I also tested the dropdown outside the edit template but inside a updatepanel it works. It happens only in a edit template. Works within an item template also.

Did anybody have a similar issue?? I very much think it is a bug in the Updatepanel and i have been using updatepanels extensively. The biggest trouble is, this issue could happen after the app goes live and data keeps accumulating.

Datasource is objectdatasource; also tried with SQLdatasource(no luck).

PartialRendering is on. (If it is switched off it works).

UpdatePanel mode is conditional (Making it always doesnot work)

Filling the items of dropdownlist in the dropdownlist_prerender (without a datasource) also gives the same error.

Id there any property that i am missing somewhere??

Best regards,

chandrakanth

Is this some kind of sync issue between the trigger event and update itself since you have 2300 items?Exactly how are you using the dropdown within the edit template? Are the values used in the update process some how?

The drop down has key-value pairs with keys as Ids and values as the designations. The Id is bound to a field of the datasource. I havel also removed the binding between dropdown and the datasource field, making it a simple dropdown with a datasource having 2300 items, and the mode does not change yet.

These values are not used anywhere in the update process.

Since the event is raised by a control inside the update panel, i am not using any triggers.

I have even tried to make everything from scratch in a test page to rebuild the issue.(Inorder to remove any effects of other controls on the updateprocess. No luck again.

chandrakanth


Some more updates on the update panel issue.

The dropdown works as long as the size is less than or equal to 894. Anything more than that which as is in my case the issue shows up. Any suggestions with a workaround for this?


Figured it out.

The issue was with the data. Data having some non ascii characters was behaving in that manner.

hope it helps others who might have a similar issue.

chandrakanth

Atlas Update Panel Content Template

Hi All,

I want to generate update panel dynamically.

I am using the following code to do that

UpdatePanel

panel =newUpdatePanel();

panel.Mode =

UpdatePanelMode.Conditional;ControlEventTrigger obj =newControlEventTrigger();

obj.ControlID =

"Button1";

obj.EventName =

"Button1_Click";

panel .Triggers.Add(obj);

I want to know how shall we add the controls to the content Template dynamically for the update panel.

Regards,
Techwork

Hello,

myUpdatePanel.Controls.Add( myGridView );

I hope this will work.


Hi,

I had already tried that. It will not work.

We need to add the controls to the content Template of the update panel and not the update panel.

Regards,

Techwork


Hi All,

I am using the following code to do the dynamic update panel.

UpdatePanel panel =newUpdatePanel();

panel.ID =

"panel";

panel.Mode =

UpdatePanelMode.Conditional;

panel.ContentTemplate = Page.LoadTemplate(

"~/UpdateUserControl.ascx");UpdateUserControl user =new UpdateUserControl();ControlEventTrigger obj =newControlEventTrigger();

obj.ControlID =((Button)user.FindControl("Button1")).ID;

panel.Triggers.Add(obj);

I am not getting any error but when I run this page the usercontrol is not loading.

I have the scriptamanager in the page. I have written this code in the Page_Load() event of the page

Do I need to do soem more things other than this?

where exactly I am going wrong?

Regards,

Techwork


Firs you have make yourself a UpdatePanelContent class. Make it a inner class within the class holding the updatepanel.
Note, the only method you need to declare in this class, additional to the constructor, is the instantiateIn . Required by the ITemplate interface

publicclassUpdatePanelContent :ITemplate

{

publicControl m_Control;

public UpdatePanelContent(Control controlToAdd)

{

m_Control = controlToAdd;

}

publicvoid InstantiateIn(Control container)

{

container.Controls.Add(m_Control);

}

}

--Now you can instantiate your panelcontent as shown.
Add your hook, page or whatever controlcollection to the panelcontent trough the updatepanelcontent contructor.

UpdatePanelContent panelContent =newUpdatePanelContent(your_control_collection);

the_updatepanel_instance.ContentTemplate = panelContent;

Regards Knut Dullum

Wednesday, March 21, 2012

Atlas script not working after partial postback

I have a DetailsView in my page for inserting new data (wich has the "Insert" mode as default) , but it only shows up when the user clics a "new" link (outside the DetailsView). The "new" link and the "cancel" link (this one as a command field inside the DetailsView) are setting the visible property of the DetailsView using an Atlas script:

The link button is declared as follows:

<

asp:LinkButtonID="linkButtonNuevo"runat="server"CausesValidation="False"EnableViewState="False"OnClientClick="javascript:return false">Crear nuevo tipo</asp:LinkButton>

(I'm usingOnClientClick="javascript:return false"to prevent a postBack)

The cancel link (inside the DetailsView command field) is set by this code in the DetailsView DataBound event handler:

link.ID =

"linkButtonCancelarNuevo";

link.Attributes[

"onClick"] ="javascript:return false";

The Atlas Script is:

<control id="ctl00_ContentPlaceHolder1_detailsViewNuevo" cssClass="HiddenElement" />

<hyperLink id="ctl00_ContentPlaceHolder1_linkButtonNuevo">

<click>

<setProperty target="ctl00_ContentPlaceHolder1_detailsViewNuevo" property="cssClass" value="VisibleElement" />

</click>

</hyperLink>

<hyperLink id="ctl00_ContentPlaceHolder1_detailsViewNuevo_linkButtonCancelarNuevo">

<click>

<setProperty target="ctl00_ContentPlaceHolder1_detailsViewNuevo" property="cssClass"value="HiddenElement" />

</click>

</hyperLink>

By the way... I'm using a MasterPage, and this things (the link and the DetailsView) are inside an UpdatePanel.

So, I can keep showing/hiding the detailsView perfectly as long as I want (clicking new / cancel)... However, when I click the insert button in the DetailsView to save the data, it saves the data (calling a server-side method) and makes a partial postBack. After that, the Atlas script does not work anymore!!! I click the new link, but absolutely nothing happens... In fact, this happens after a partial postback caused everywhere else in the page...

I don't know if there is something I'm missing about the script or the UpatePanel and the partial postback... so, can anyone tell me what is happening here?

Thanks for any help

AlexPhi

hello.

well, i'm assuming that you've placed the links inside the updatepanel...in that case, the xml-script will be discarded since those objects will be destroyed (ie, replaced), when the client receives the new html sent from the server. if this is your scenario, then you must introduce the xml-script during all the postbacks (i think that you might have to build an extender that adds this code to the page during all the postbacks).