Showing posts with label state. Show all posts
Showing posts with label state. Show all posts

Monday, March 26, 2012

TreeView with checkboxes

Hi

As you know the nativ TreeView control does not populate the check state (when the attributeShowCheckBoxes="All") to his children nodes for perfomance reason.

Is it a way with Ajax and a timer to do the thing ?

I wrote this but i got flickering on the lines redraw of the TreeView

Any help ?

<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="500" />
<asp:UpdatePanel ID="UpdatePanel" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" />
</Triggers>
<ContentTemplate>
<asp:TreeView ID="TreeView1" runat="server" ShowCheckBoxes="All" ShowLines="true" OnTreeNodeCheckChanged="OnSelectPlayer">
</asp:TreeView>
<br />
<asp:Button ID="Button1" runat="server" OnClick="OnSelect" Text="Valider la sélection" Width="127px" />
</ContentTemplate>
</asp:UpdatePanel>

Thank you a lot

Hi,

Please specify <compilation debug="false"> in web.config.

In asp.net, when in debug mode, images and javascript files severed from a web resource handler won't be cached on client.

Hope this helps.

Wednesday, March 21, 2012

trouble with a simple scenario with Atlas(dependent dropdownlists)

Hi,

I have two dropdowns, for example states and counties.

When I change a state the right counties list should load in the counties dropdown.

It works fine with an updatepanel and a trigger to the States dropdown, until I add a "select from list" item and set AppendDataBoundItems=true. What happens is whenever I change the index of the first dropdown, the corresponding items are added to the second dropdown while it already has values from all the previous selections.

Is it possible to redraw the whole dropdown without add items from subsequent databinds?

Any suggestions would be welcome.

Thanks

hello.

can you show us a small page that reproduces the problem you're having? thanks.


Here is the code:

<

atlas:ScriptManagerID="s1"EnablePartialRendering="True"runat="server"EnableViewState="False"></atlas:ScriptManager><tablecellpadding="4"><tr><tdstyle="height: 73px"><asp:DropDownListID="ddlPosition"runat="server"AppendDataBoundItems="True"AutoPostBack="True"DataSourceID="dsPositions"DataTextField="PositionName"DataValueField="PositionID"><asp:ListItemValue="0">select from list</asp:ListItem></asp:DropDownList><asp:SqlDataSourceID="dsPositions"runat="server"ConnectionString="<%$ ConnectionStrings:conninfo %>"SelectCommand="Get_Positions"SelectCommandType="StoredProcedure"></asp:SqlDataSource></td><tdstyle="height: 73px"><atlas:UpdatePanelID="upStates"runat="server"EnableViewState="true"Mode="Conditional"><ContentTemplate><asp:DropDownListID="ddlStates"runat="server"AutoPostBack="True"DataSourceID="dsStates"DataTextField="StateName"DataValueField="StateID"AppendDataBoundItems="True"><asp:ListItemValue="0">select from list</asp:ListItem></asp:DropDownList><asp:SqlDataSourceID="dsStates"runat="server"ConnectionString="<%$ ConnectionStrings:conninfo %>"SelectCommand="Get_States_with_Jobs_by_Position"SelectCommandType="StoredProcedure"><SelectParameters><asp:ControlParameterControlID="ddlPosition"Name="PositionID"PropertyName="SelectedValue"Type="Int32"/></SelectParameters></asp:SqlDataSource></ContentTemplate><Triggers><atlas:ControlEventTriggerControlID="ddlPosition"EventName="SelectedIndexChanged"/></Triggers></atlas:UpdatePanel></td><tdstyle="height: 73px"><atlas:UpdatePanelID="upRegions"runat="server"Mode="Conditional"><ContentTemplate><asp:DropDownListID="ddlRegions"runat="server"AutoPostBack="True"DataSourceID="dsRegions"DataTextField="RegionName"DataValueField="RegionID"AppendDataBoundItems="True"><asp:ListItemValue="0">select from list</asp:ListItem></asp:DropDownList><asp:SqlDataSourceID="dsRegions"runat="server"ConnectionString="<%$ ConnectionStrings:conninfo %>"SelectCommand="Get_Regions_by_State_Position"SelectCommandType="StoredProcedure"><SelectParameters><asp:ControlParameterControlID="ddlPosition"Name="PositionID"PropertyName="SelectedValue"Type="Int32"/><asp:ControlParameterControlID="ddlStates"Name="StateID"PropertyName="SelectedValue"Type="Int32"/></SelectParameters></asp:SqlDataSource></ContentTemplate><Triggers><atlas:ControlEventTriggerControlID="ddlStates"EventName="SelectedIndexChanged"/></Triggers></atlas:UpdatePanel></td></tr><tr><tdcolspan="3"><atlas:UpdatePanelid="upGrid"runat="Server"Mode="Conditional"><ContentTemplate><asp:GridViewID="GridView1"runat="server"AllowSorting="True"AutoGenerateColumns="False"CellPadding="4"DataSourceID="dsJobs"ForeColor="#333333"GridLines="None"><FooterStyleBackColor="#5D7B9D"Font-Bold="True"ForeColor="White"/><Columns><asp:BoundFieldDataField="LocationName"HeaderText="LocationName"ReadOnly="True"SortExpression="LocationName"/></Columns><RowStyleBackColor="#F7F6F3"ForeColor="#333333"/><EditRowStyleBackColor="#999999"/><SelectedRowStyleBackColor="#E2DED6"Font-Bold="True"ForeColor="#333333"/><PagerStyleBackColor="#284775"ForeColor="White"HorizontalAlign="Center"/><HeaderStyleBackColor="#5D7B9D"Font-Bold="True"ForeColor="White"/><AlternatingRowStyleBackColor="White"ForeColor="#284775"/></asp:GridView><asp:SqlDataSourceID="dsJobs"runat="server"ConnectionString="<%$ ConnectionStrings:conninfo %>"SelectCommand="Get_Jobs_by_Regions"SelectCommandType="StoredProcedure"><SelectParameters><asp:ControlParameterControlID="ddlPosition"Name="PositionID"PropertyName="SelectedValue"Type="Int32"/><asp:ControlParameterControlID="ddlRegions"Name="RegionID"PropertyName="SelectedValue"Type="Int32"/></SelectParameters></asp:SqlDataSource></ContentTemplate><Triggers><atlas:ControlEventTriggerControlID="ddlRegions"EventName="SelectedIndexChanged"/></Triggers></atlas:UpdatePanel></td></tr></table>

any ideas?

thanks


hello.

well, presenting this kind of page will give few chances of getting an answer :(

can you build a demo page that doesn't use sqldatasource to get its data? for instance, use dummy arrays and bind them to the dropdowns a la ASP.NET 1.X...by doing this, you'll build a page that i and others (brighter than me) can simply copy and paste and run...then you'll probably get an answer.

thanks.


Does it work without the update panel?

You have this set "AppendDataBoundItems="True"which will cause this to happen - turn this off and it won't append it any longer.


You have to clear out all the items before you bind different data to them.

Use dropdownlist.items.clear()

You will have to readd any static items that you may want before databinding.