Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

Wednesday, March 28, 2012

Control extenders and dispose

I'm having a problem using multiple control extenders on a single web control. The control is a table, and I have two custom extenders (which inherit from ExtenderControl) extending the table. Both of these extenders add event handlers to both the table and window. The problem I'm having is that the dispose method (which MUST be called to remove the window events on an asynchronous postback) is only being called on ONE of the extenders. This seems to always be the most recent extender (in markup - I've tried switching the order that the extenders are defined in markup to verify this behavior). On a full page postback, both dispose methods are always called. Is this some kind of bug? Or is there something I am doing wrong in my extender implementation(s)? I really can't post the full code of my extenders, but if neccessary I can try to create a simple example that displays the behavior.

Ouch - nobody has any idea? Should this maybe be posted in a different forum? Any additional info I can add? This is really causing me problems in my current project...

Content getting clipped in Firefox when Sliders are displayed

Hi,

I have a 2 column layout with a left nav and main content area implemented using a table. I have sliders in the left nav and the left nav is of a greater height than the main content area. When the sliders are dynamicallly displayed during page load, it causes the left nav to be expanded vertically. In Firefox, this expansion causes content at the bottom of the left nav to get clipped rather than the cell expanding to accommodate the new content.

I have implemented the same layout in CSS with the same result. The below example reproduces this problem although I have to press Ctrl + F5 in Firefox to get it to exhibit the problem with this example...in my real application it occurs when the page is opened.

<%@dotnet.itags.org.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default2.aspx.cs"Inherits="Default2" %>

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

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

<formid="form1"runat="server">

<div>

<atlas:ScriptManagerID="ScriptManager1"runat="server"EnablePartialRendering="true"/>

<tablewidth="100%"cellpadding="0"cellspacing="0">

<tr>

<tdnowrap="nowrap"bgcolor="#f4f4f4"valign="top">

<asp:PanelID="_hidePanel"runat="server"Width="250">

<asp:LabelID="_sliderValueLabel"runat="server"></asp:Label>

<asp:TextBoxID="_sliderTextBox"runat="server"Style="display: none;"></asp:TextBox>

<AtlasControlToolkit:SliderExtenderID="_slider"runat="server">

<AtlasControlToolkit:SliderPropertiesMinimum="1"Maximum="10"Steps="10"TargetControlID="_sliderTextBox"

Length="218">

</AtlasControlToolkit:SliderProperties>

</AtlasControlToolkit:SliderExtender>

<br/>

This text vanishes!!

</asp:Panel>

</td>

<tdwidth="99%"valign="top">

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

<ContentTemplate>

<asp:LinkButtonID="_hideLink"runat="server"Text="Hide Panel"></asp:LinkButton>

<AtlasControlToolkit:CollapsiblePanelExtenderID="_hideCollapsiblePanel"runat="server">

<AtlasControlToolkit:CollapsiblePanelPropertiesTargetControlID="_hidePanel"ExpandControlID="_hideLink"

CollapseControlID="_hideLink"CollapsedText="Show Panel"ExpandDirection="Horizontal"

SuppressPostBack="true">

</AtlasControlToolkit:CollapsiblePanelProperties>

</AtlasControlToolkit:CollapsiblePanelExtender>

</ContentTemplate>

</atlas:UpdatePanel>

</td>

</tr>

</table>

</div>

</form>

</body>

</html>

Cheers,

Jason

Thanks for the repro. I've created work item 3450 to track this.

It seems that it might be a combination of the CollapsiblePanel and the Sliders that are causing this problem. The CollpasiblePanel creates a parent div to hold the content and gets the dimensions during intialisation. I am guessing that this might be happening before the sliders have initialised so that the dimensions of the wrapper div are not correct.

I noticed that when the ScrollContents attribute is set to false, the wrapper div overflow style is set to hidden in CollapsiblePanelBehaviour.js at line 456. When I change this to visible then the content is no longer clipped but the background colour of the containing table cell (see forum thread for repro) does not expand down with the expanded div content. I am not sure why the overflow is being set to hidden as I would have thought that all of the content in the panel that is being wrapped should always be visible.

This problem is still occuring in FF 2.0 although works OK in IE7.


OK...the hack of setting the overflow to visible doesn't work correctly as some of the overflowed content then overlaps with the content below instead of expanding the table cell as hoped. I removed the CollapsiblePanel, hiding the container on the server side instead, and the problem goes away so it is definitely related to the CollapsiblePanel.

Monday, March 26, 2012

ConfirmButtonExtender-bug in nested GridViews?

In a GridView1 i show a table. I can edit, and if I click at the Delete-Button, i become the Confirm-Window of ConfirmButtonExtender1. All the world is sunny.

Now I set in a column of GridView1 a TemplateField, in this I set another GridView2. I can see all this very nice. I, too, can click at the delete-Button in GridView2 and become the Confirm-Window of ConfirmButtonExtender2, finelly! But curious, if I click at the edit-Button (ImageButton WITHOUT ConfirmButtonExtender!) I become the Error:

The control with ID 'ConfirmButtonExtender2' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.

ScriptManager I have inserted of course. Please help me! Thanks

Joerg

<asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"CellPadding="2" DataSourceID="SqlDataSource1" AllowPaging="True" DataKeyNames="ID" GridLines="None" ForeColor="#333333">
...
<Columns>
<asp:CommandField ButtonType="Image" CancelImageUrl="~/Images/rbCancel.gif" ... />
...Boundfields...
<asp:TemplateField InsertVisible="False" ShowHeader="False">
<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="False" CommandName="Delete" ImageUrl="~/Images/rbDel.gif" />
<cc1:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="ImageButton1" ConfirmText="Realy clear?" />
</ItemTemplate></asp:TemplateField
<asp:TemplateField InsertVisible="False">
<ItemTemplate>
<asp:HiddenField ID="HiddenField" runat="server" Value='<%# Bind("IDType") %>' /> <asp:SqlDataSource ID="SqlDataSource2" runat="server" ...>
</asp:SqlDataSource
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource2" DataKeyNames="ID" OnRowEditing="GridView2_RowEditing" >
...
<Columns>
<asp:CommandField ButtonType="Image" CancelImageUrl="~/Images/rbCancel.gif" ... ShowEditButton="True" />
...Boundfields etc. ...
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False" CommandName="Delete" ImageUrl="~/Images/rbDel.gif" />
<cc1:ConfirmButtonExtender ID="ConfirmButtonExtender2" runat="server" TargetControlID="ImageButton2" ConfirmText="Realy clear?" />
</ItemTemplate> </asp:TemplateField>
</Columns>
</asp:GridView>
/ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

Hi,

Where is your ScriptManager ?


It's on the bottom, but i'll become the error with Scriptmanager at top and all places too. :-(

 <asp:ScriptManager ID="ScriptManager1" runat="server" /> </form></body></html>

Wednesday, March 21, 2012

Composite control does update second time

So I have a composite control that allows me to generate a form with our having to write out all the table stuff. It looks some thing like:

<cc2:FieldList ID="flUsers" runat="server" LabelCellCssClass="labelCell"> <Fields> <LDAPField FieldID="NetID" Label="Net ID:" Required="true" OnLDAPFieldClick="LoadLDAPFields" /> <TextField FieldID="FirstName" Label="First Name:" Required="true" /> <TextField FieldID="LastName" Label="Last Name:" Required="true" /> <TextField FieldID="Email" Label="Email:" Required="true" /> <TextField FieldID="Phone" Label="Phone #:" Required="true" /> <TextField FieldID="Room" Label="Room #:" Required="true" /> <DropDownField FieldID="Departments" Label="Dept:" DataSourceID="sqldsDepartments" DataTextField="DepartmentName" DataValueField="ID"> </DropDownField> <DropDownField FieldID="UserTypes" Label="User Type:" DataSourceID="sqldsUserTypes" DataTextField="UserType" DataValueField="ID"> </DropDownField> </Fields> <Buttons> <Button ID="btnAddUser" runat="server" Text="Add User" OnClick="btnAddUser_Click"> </Button> <Button ID="btnClearFields" runat="server" Text="Clear" CausesValidation="false" OnClick="btnClearFields_Click"> </Button> </Buttons></cc2:FieldList>
At this point in time, we have the ability to assign events to all the buttons, and onchange events to the drop down lists. Everything works fine when there is no update panel surrounding it. We, however, would like it to work with an update panel. The control renders fine on the initial page load. It also works fine on the first event we fire such as clicking a button or changing drop down index. We run into problems when we click buttons or change indexes after that. Nothing works after. Does anyone have any ideas?

in the updatepanel do you have "ChildrenAsTriggers="false"" and do you have "UpdateMode="Conditional""? If not try UM=f first, then UM=f & CAT=f and see if that solves your problem...

p.s. setting UM=c means you'll need to use triggers to update the updatepanel fromoutside the updatepanel. anything inside that calls a postback will automatically cause the updatepanel to do an async postback

Compilation error UpdatePanel in Repeater

Hi,

I have a repeater with ItemTemplate and AlternativeTemplate. Within the repeater there is a Table. Inside of one of the <td> I have UpdatePanel, so in the ItemTemplate there is an UpdatePanel1 and there is another one in the AlternativeTemplate with the same ID name, I thought this won't have any conflict since we can put two controls with same ID as long as they are in the different Template. But I got this error :

Description:Anerror occurred during the compilation of a resource required to servicethis request. Please review the following specific error details andmodify your source code appropriately.

Compiler Error Message:CS0102: The type 'NamespaceName' already contains a definition for 'A_ControlName'

any help would be great.

thanks

I had a very similar problem - had a datalist where each itemtemplate contained an updatepanel.Inside the itemtemplate was a control called "selDriver", and on the main page there was also a control called "selDriver" - this was never a problem until the updatepanel was added in, and then it broke the compilation.I had to change the control's name in the main page to something different (which in retrospect I should have done anyway!) so I suspect you are experiencing something similar.Good luck!

Try to do with different name for both controls

comparision with old data

Hi,

I am trying to have a display data in a table inside a update pannel. Basic idea is to get refreshed data and display for user. So far so good. But i want to heighlight the data that is changed since all data may not change everytime though its fetched everytime. How do i chk if data is changed or not ? since each time what i have is only updated value from database. I tried storing data in simple hidden input field dynamically, but as its refreshing only part of page, its not posted, and i could not access it. Does anybody know a way to do this in better way ?

Thanks :)

This is just a thought and I dont know if it will work or not, but maybe use two Datasets, one dataset for the currently displayed data and the other dataset for the new/pending to display data. Itterate though both in a loop, compare the values in the same index postion and if they are different, make your style changes, otherwise, make no style changes. As you itterate though the loop, copy the value from the new/pending dataset to the current dataset. Your new/pending dataset becomes the old one. Although, I think this might need more thought than what I simply typed here.

You may want to go with a similar approach still using the current dataset and the new/pending dataset but create an array that contains the data with its style that you are going to display. You still do the comparison as I mentioned above, but instead of changing the dataset, you change the values in the array. After the comparsion is complete, you render the table based on what is in the array. You then close the old data set or make its data source be that of the new/pending data source.

Another option, instead of using the array is to build the table dynmaically and storing the the values in there as apposed to the array. You have to store the values somewhere so why not store them in the object that you plan to render anyways. This I am assuming you are creating your tables like this: Table tbl = new Table TableRow tr= new TableRow

I wanted to give you a few options but I think the last one is your best one. With the last option you may not even need two datasets, you only need your new/pending one and you always compare it with what is in the value of your TableCell. This will only work if you are using Table Controls as apposed to creating yoru tables like so: string strTable += "<td>" + strSomeValue + "</td>";

If you need further help on the thrid option (Using a table control with one dataset) let me know. I think this is the best way to go.

Good luck!


Thanks really for that quick reply. I would like to try on the array meathod, since in this application i'm anyway gonna strain the db by calling refreshed entries every 3 seconds, from 100s of users at a time. So i guess array will be managible. But can u help me a bit further as to how i create an array that has dynamic number of elements, since for every user it'll be different no of elements, depending on wht he has opted for.


shiloo75:

I tried storing data in simple hidden input field dynamically, but as its refreshing only part of page, its not posted, and i could not access it.

The hidden input value is posted even when it is outside of your updatepanel!

You can get the value of the hidden field this way:

Page.Request.Form.Get( "your field's id" )