Showing posts with label states. Show all posts
Showing posts with label states. Show all posts

Wednesday, March 28, 2012

TreeView and UpdatePanel - Beta 2

I believe the documentation states the treeview is not supported in an UpdatePanel but has anyone manged to make it work? There have been a bunch of posts that seem to indicate some success. I have a treeview driving a formview in an UpdatePanel. To make things work I think I just have to stop the SelectedNode from causing a postback and then wire up some javascript to "call" the UpdatePanel around the formview. Or is support for a treeview in a UpdatePanelimminent?

Thanks in advance

I have tried asp:TreeView and asp:UpdatePanel in the latest Ajax and find we can get the selected node of a TreeView in a asp:UpdatePanel.You can use a TreeView to drive a FormView in a asp:UpdatePanel.
Here are some sample codes for your reference.
HTML code in .aspx

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.