Showing posts with label builds. Show all posts
Showing posts with label builds. Show all posts

Monday, March 26, 2012

UpdatePanel & DHTML/.htc behavior

Hoping for the final piece of my ATLAS jigsaw here...

I have a WebControl that builds a table and uses the onDocumentReady event to make it scrollable, with the code in an htc file, referenced in the behavior section of the css of the table.

My WebControl works perfectly with the ATLAS UpdatePanel, and will scroll as expected when first loaded. However - upon a callback to sort the data etc, as the onDocumentReady event will not be fired when the UpdatePanel refreshes, the DHTML doesn't get triggered, and nothing gets applied to the table in the control.

Does anyone (please) have experience, or know how, of using a control in an ATLAS UpdatePanel, that allows the DHTML to be executed (e.g. through an alternative to onDocumentReady) on callback, as it would be usually on PostBack?

Thanks in advance!

Hi,

There is no specific event for this today, but I have logged your suggestion as part of some new work we hope to be doing to UpdatePanel.

Thanks,

Eilon

Saturday, March 24, 2012

UpdatePanel and Dynamic populated table

My control builds a table dynamically [some subscription rows]

The table is placed inside and update panel:

<atlas:UpdatePanel ID="upBrowse" runat="server" Mode="Conditional" RenderMode="Inline"> <Triggers> <atlas:ControlEventTrigger ControlID="btnDelete" EventName="Click" /> <atlas:ControlEventTrigger ControlID="btnOK" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Table ID="tblSubscriptions" runat="server" CellPadding="1" CellSpacing="1" Style="position: relative" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" EnableViewState="true"> </asp:Table> <br /> <asp:Button ID="btnAdd" Text="Add" runat="server" OnClick="btnAdd_Click" /> <asp:Button ID="btnDelete" Text="Delete" runat="server" OnClick="btnDelete_Click" /> </ContentTemplate> </atlas:UpdatePanel>

When the table gets populated, there is a checkbox for each row to select the subscriptions to be deleted.

There is a Delete Button and the task is to select all the checked rows and delete them.

My problem is that on the trip back, handling the delete button 'btnDelete_Click' I cannot iterate the table programmatically because there are no rows:

foreach (TableRow rowin tblSubscriptions.Rows) --> no rows

What is wrong?

Thx,

Uri

Can you show a some code how you add dynamic rows? Just as an idea - maybe HtmlTableRow instead TableRow? You can use Repeater with checkboxes instead your table, and you will receive selected values in the Form collection...
foreach (Subscription oSubin oSubscriptions) { count++;if ((int)oSub.GetFieldValue("SystemID") == _systemId) { TableRow row =new TableRow();if (bInStyleAlt) { row.ApplyStyle(styleAlt); bInStyleAlt =false; }else { row.ApplyStyle(styleNormal); bInStyleAlt =true; } CheckBox box =new CheckBox(); box.ID ="chkSub_" + oSub.SubscriptionId; box.Checked =false; TableCell cellChk =new TableCell(); cellChk.Controls.Add(box); row.Cells.Add(cellChk);

Interesting points:

I am able to manipulate other elements inside the update panel (like textboxes) if these are not inserted dynamically.

Let me try HtmlTableRow or the repeater