treeview change place after checking node in the web application - asp.net

i have an asp.net treeView. on node expanded i'm binding child nodes for the expanded node. But if i check the node and than expand it, the node and all it's child change there position and become like childs to the main node. when clicking again on the + it takes the right place. Any idea on how to solve it!!!
<asp:Panel ID="pnl_tree_testplan" CssClass="pnl_treeview" runat="server" ScrollBars="Auto">
<asp:UpdatePanel ID="treeview_testplan" runat="server">
<ContentTemplate>
<asp:TreeView ID="testPlanTreeView" runat="server" OnLoad="Tree_TestPlan_Load" OnTreeNodeExpanded="Tree_TestPlan_Node_Expanded"
OnTreeNodeCheckChanged="TestPlan_Treeview_TreeNodeCheckChanged">
</asp:TreeView>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
.pnl_treeview
{
Height:410px;
border-width:1px;
border-color:Blue;
min-width:260px;
width:100%;
font-family:Calibri;
font-size:small;
color:Black;
}

If it's "jumping up and down" in Firefox (esp.) when you hover over the nodes, try this CSS fix:
<div id="idTreeView">
<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="SiteMapDataSource1"
HoverNodeStyle-Height="0" Font-Bold="true" ImageSet="BulletedList">
<RootNodeStyle Font-Bold="True" />
<ParentNodeStyle VerticalPadding="0px" Font-Bold="True"
Font-Underline="false" />
<HoverNodeStyle Font-Underline="false" ForeColor="#5555DD" />
<NodeStyle Font-Bold="False" Font-Size="8pt" CssClass="sitelink"
ForeColor="Black" HorizontalPadding="5px" NodeSpacing="0px"
VerticalPadding="0px" />
</asp:TreeView>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</div>
div#idTreeView img
{
display: block;
float: left;
}
div#idTreeView div
{
display: inline-block;
}
div#idTreeView .sitelink a
{
text-decoration:none;
}

Related

Grid View is visible in design mode but invisible on execution in asp.net

I have a asp.net aspx with the code as below:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="globalWrapper">
<div class="Header">
<asp:DropDownList ID="dropDownState" runat="server" class="Controls">
</asp:DropDownList>
<asp:TextBox ID="txtFromDate" runat="server" Text="Choose From Date..." class="Controls"></asp:TextBox>
<asp:Button ID="btnFromDate" runat="server" Text="..." class="btnDate" OnClick="btnFromDate_Click" />
<asp:TextBox ID="txtToDate" runat="server" Text="Choose To Date..." class="Controls"></asp:TextBox>
<asp:Button ID="btnToDate" runat="server" Text="..." class="btnDate" OnClick="btnToDate_Click" />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" class="btnControls" OnClick="btnSubmit_Click" />
<asp:Button ID="btnLogout" runat="server" Text="Log Out" class="btnControls" OnClick="btnLogout_Click" />
</div>
<div class="calendarFromDate">
<asp:Calendar ID="calendarFromDate" runat="server" BackColor="White"
BorderColor="#3366CC" BorderWidth="1px" CellPadding="1"
DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt"
ForeColor="#003399" Height="200px" Visible="False" Width="220px"
onselectionchanged="calendarFromDate_SelectionChanged">
<DayHeaderStyle BackColor="#99CCCC" ForeColor="#336666" Height="1px" />
<NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
<OtherMonthDayStyle ForeColor="#999999" />
<SelectedDayStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<SelectorStyle BackColor="#99CCCC" ForeColor="#336666" />
<TitleStyle BackColor="#003399" BorderColor="#3366CC" BorderWidth="1px"
Font-Bold="True" Font-Size="10pt" ForeColor="#CCCCFF" Height="25px" />
<TodayDayStyle BackColor="#99CCCC" ForeColor="White" />
<WeekendDayStyle BackColor="#CCCCFF" />
</asp:Calendar>
</div>
<div class="calendarToDate">
<asp:Calendar ID="calendarToDate" runat="server" BackColor="White"
BorderColor="#3366CC" BorderWidth="1px" CellPadding="1"
DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt"
ForeColor="#003399" Height="200px" Visible="False" Width="220px"
onselectionchanged="calendarToDate_SelectionChanged">
<DayHeaderStyle BackColor="#99CCCC" ForeColor="#336666" Height="1px" />
<NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
<OtherMonthDayStyle ForeColor="#999999" />
<SelectedDayStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<SelectorStyle BackColor="#99CCCC" ForeColor="#336666" />
<TitleStyle BackColor="#003399" BorderColor="#3366CC" BorderWidth="1px"
Font-Bold="True" Font-Size="10pt" ForeColor="#CCCCFF" Height="25px" />
<TodayDayStyle BackColor="#99CCCC" ForeColor="White" />
<WeekendDayStyle BackColor="#CCCCFF" />
</asp:Calendar>
</div>
<div class="Contents">
<div class="gridView">
<asp:GridView ID="gridStateErrorData" runat="server" BackColor="White" BorderColor="#336666"
BorderStyle="Double" BorderWidth="3px" CellPadding="4" HorizontalAlign="Center">
<FooterStyle BackColor="White" ForeColor="#333333" />
<HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="White" ForeColor="#333333" />
<SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F7F7F7" />
<SortedAscendingHeaderStyle BackColor="#487575" />
<SortedDescendingCellStyle BackColor="#E5E5E5" />
<SortedDescendingHeaderStyle BackColor="#275353" />
</asp:GridView>
</div>
</div>
<div id="chart_container" class="chartContainer" runat="server">
</div>
<asp:Literal ID="literalMapIndia" runat="server"></asp:Literal>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnFromDate" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnToDate" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="dropDownState" EventName="SelectedIndexChanged" />
<asp:PostBackTrigger ControlID="btnSubmit" />
<asp:PostBackTrigger ControlID="btnLogout" />
</Triggers>
</asp:UpdatePanel>
</form>
On Submit button click based on logic it is fetching the data from SQL Server 2008 and should display it in GridView. But on execution I'm unable to see the GridView on web page. However if I switch to design mode in visual studio I can pretty much see the GridView there.
I tried removing the division's calendarFromDate and calendarToDate the GridView works fine. I think these div's are actually hiding the underlying GridView. I tried using "z-index = -1" as style attribute to them but no change. What am I missing here? Thanks in advance
My CSS is as below:
body
{
background: #B4C8E1;
font-size: .80em;
font-family: "Helvetica Neue", "Lucida Grande", "Segoe UI", Arial, Helvetica, Verdana, sans-serif;
margin: 0px;
padding: 0px;
color: #696969;
}
.globalWrapper
{
width: 100%;
height:auto;
background-color : #6E83B6;
}
.Header
{
width : 99%;
margin-left:0.5%;
border:2px solid black;
height: 45px;
background-color:Blue;
vertical-align:middle;
}
.Controls
{
margin-top:10px;
margin-left:6%;
font-weight:bold;
text-align:center;
}
.btnControls
{
margin-top:10px;
margin-left:6%;
width: 8%;
font-weight:bold;
}
.btnDate
{
width:3%;
text-align:center;
font-weight:bold;
}
.calendarFromDate
{
position:relative;
margin-left:29%;
float:left;
width:17%;
}
.calendarToDate
{
position:relative;
margin-right:32%;
float:right;
width:17%;
}
.Contents
{
width: 99%;
height: auto;
margin-left:0.5%;
border:2px solid black;
}
.gridView
{
width:50%;
height:auto;
margin-left:25%;
text-align:center;
}
.chartContainer
{
width:90%;
height:600px;
margin-left:5%;
z-index:-1;
}
Edit : Code Behind
protected void btnSubmit_Click(object sender, EventArgs e)
{
chart_container.Visible = false;
List<StateData> stateData = new List<StateData>();
DataAccessLayer data = new DataAccessLayer();
stateData = data.getStateData(dropDownState.SelectedItem.Text.ToString(), txtFromDate.Text.ToString(), txtToDate.Text.ToString());
gridStateErrorData.DataSource = stateData;
gridStateErrorData.DataBind();
}
I think two divisions calendarFromDate and calendarToDate are hiding the regarding division as you said.
Try adding specific height and float property to Contents and gridView classes in your css code.
.Contents
{
width: 99%;
height: 500px;
margin-left:0.5%;
border:2px solid black;
float:left;
}
.gridView
{
width:50%;
height:600px;
margin-left:25%;
text-align:center;
float:left;
}

Update updatepanel from within a ajax modalpopup

I have a aspx page with a ajax modalpopup control in it. I need to update the contents inside an updatepanel on the page(not inside modalpopup) when I do a button click inside the modalpopup.
So I can display the changes inside the updatepanel without a full page refresh. I already tried using the UpdatePanel.Update() method inside the code behind of the button click event. But it does nothing.
What I'm doing right now is make a full page refresh inside the button click event.
there anyway that I can update the update panel to display the changes?
Update: Here is the code snippet in the related aspx page.
<div style="width: 400px; height: 200px; float: right;">
<br />
<asp:UpdatePanel ID="UpdatePanel5" runat="server" UpdateModel="Conditional">
<ContentTemplate>
<asp:Label ID="lblDate" runat="server"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnGetSelectedDate" />
</Triggers>
</asp:UpdatePanel>
</div>
<ajaxToolkit:ModalPopupExtender ID="mpeUpcomingDaysOff" runat="server" PopupControlID="panelUpcomingDaysOff" BackgroundCssClass="modalBackground" DropShadow="true" Enabled="True" TargetControlID="btnChangeUpcomingDaysoff" OkControlID="btnGetSelectedDate" CancelControlID="btnUpcomingDaysOffCancel" OnOkScript="window.top.location.reload();">
</ajaxToolkit:ModalPopupExtender>
<asp:Panel ID="panelUpcomingDaysOff" runat="server" Height="400" Width="700" BackColor="White" Style="border-radius: 5px">
<div style="height: 50px; width: 700px; padding-left: 100px; font-family: Verdana; padding-top: 5px">
<div>
<span style="font-weight: bold">Upcoming Daysoff for
<asp:Label ID="lblProviderNameDaysOff" runat="server"></asp:Label></span><br />
<span style="font-size: 12px">Select vacation and any other days when this service provider will not be available for online appointments.</span>
</div>
<div style="height: 300px; padding-left: 150px">
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<ContentTemplate>
<asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="Black"
Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" Height="250px" OnPreRender="Calendar1_PreRender" Width="330px"
OnSelectionChanged="Calendar1_SelectionChanged" OnLoad="Calendar1_Load" BorderStyle="Solid" CellSpacing="1" NextPrevFormat="ShortMonth">
<DayHeaderStyle Font-Bold="True"
Height="8pt" Font-Size="8pt" ForeColor="#333333" />
<DayStyle BackColor="#CCCCCC"></DayStyle>
<NextPrevStyle Font-Size="8pt" ForeColor="White" Font-Bold="True" />
<OtherMonthDayStyle ForeColor="#999999" />
<SelectedDayStyle BackColor="#333399" ForeColor="White" />
<TitleStyle BackColor="#333399" Font-Bold="True"
Font-Size="12pt" ForeColor="White" BorderStyle="Solid" Height="12pt" />
<TodayDayStyle BackColor="#999999" ForeColor="White" />
</asp:Calendar>
<br />
<asp:Button ID="btnGetSelectedDate" runat="server" Text="OK" OnClick="btnGetSelectedDate_Click" />
<asp:Button ID="btnUpcomingDaysOffCancel" runat="server" Text="Cancel" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
In your update panel you wish to update you need to declare the button of your modal div as async postback trigger.
<asp:UpdatePanel ID="upPanel" runat="server" UpdateModel="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Id_Of_Button_In_ModalDiv" />
</Triggers>
<ContentTemplate>
....
</ContentTemplate>
</asp:UpdatePanel>
Keep in mind though that your modal div should not be part of the update panel. If it is, it will disappear after call back as everything within the ContentTemplate will be replaced with content from server.

How to have UpdateProgress whthin disabling a page after hit a button in grid view

I have a grid view and inside it i used an update panel and because of using a file upload in it, I use trigger method. What i want is to have a nice update progress as an user hit a button in the grid view. I need to make the page disable and showing the downloading animation. like the below picture. However instead of the dialog message, a loading
animation must be appear. Is it solvable?
And here is my cod that i used, but it wasn't work:
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" onrowdatabound="GridView1_RowDataBound"
DataKeyNames="ID,ArticleID,UserName" DataSourceID="SqlDataSource1"
GridLines="Vertical" AllowPaging="True" PageSize="5" OnRowUpdating="GridView1_RowUpdating">
<Columns>
<asp:TemplateField>
<ItemTemplate>
.......some stuffs
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="Gridview1" />
</Triggers>
</asp:UpdatePanel>
I also used this:
.Background
{
position: relative;
left: 0;
top: 0;
z-index: 10;
width: 100%;
height: 100%;
filter: alpha(opacity=40)
}
And this
<asp:UpdateProgress ID="UpdateProgress4" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<DIV id="IMGDIV" align="center" valign="middle" runat="server" style=" position: relative; visibility:visible; vertical-align:middle; border-style :inset;border-color:black;background-color:white;z-index:40; top:45%;">
<img src="../images/NewLoader.gif" /><br />
<%-- <input type="button" onclick="CancelPostBack()" value="Cancel" />--%>
</DIV>
</ProgressTemplate>
</asp:UpdateProgress>
I think you have to use
<asp:AsyncPostBackTrigger>
not
<asp:PostBackTrigger >
<asp:UpdateProgress> will work only for Async calls.

ASP.NET Treeview Image background

I have a tree view control that I would like to supply the background image for. My code currently looks like this:
<asp:Image ImageUrl="~/images/mypic.gif" runat="server" Width="150px" />
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1"
ImageSet="Arrows">
<ParentNodeStyle Font-Bold="False" />
<HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
<SelectedNodeStyle Font-Underline="True"
HorizontalPadding="0px" VerticalPadding="0px" ForeColor="#5555DD" />
<NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black"
HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" />
</asp:TreeView>
there is a property of the treeview CssClass that you can give it an image via css
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1"
CssClass="classname" ImageSet="Arrows">
<ParentNodeStyle Font-Bold="False" />
<HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
<SelectedNodeStyle Font-Underline="True"
HorizontalPadding="0px" VerticalPadding="0px" ForeColor="#5555DD" />
<NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black"
HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" />
</asp:TreeView>
then in css
.classname
{
background-image: url('image path');
}
I would think the best way to achieve this would be to use CSS. I do not know off the top of my head what sort of html the TreeView control spits out but if it is a block element you should be able to set the background property to display your image.
An easy way to do this would be to surround your Treeview in a <div> block and set the css styling on this.
<div id="treeNav">
<asp:TreeView .........
</asp:TreeView>
</div>
#treeNav
{
background-image: url(my-image.png);
}

How To Prevent TreeView from changing its position?

Whenever I collapse or open node in the tree view, it jumps up and down to be in the middle of the page. Is there any way to keep it still in its position and prevent that?
Here's some CSS to fix this (I'm assuming this is happening in Firefox?):
<div id="idTreeView">
<asp:TreeView ID="TreeView1" runat="server"
DataSourceID="SiteMapDataSource1"
HoverNodeStyle-Height="0" Font-Bold="true" ImageSet="BulletedList">
<RootNodeStyle Font-Bold="True" />
<ParentNodeStyle VerticalPadding="0px" Font-Bold="True" Font-Underline="false" />
<HoverNodeStyle Font-Underline="false" ForeColor="#5555DD" />
<NodeStyle Font-Bold="False" Font-Size="8pt" CssClass="sitelink"
ForeColor="Black" HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" />
</asp:TreeView>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</div>
div#idTreeView img
{
display: block;
float: left;
}
div#idTreeView div
{
display: inline-block;
}
div#idTreeView .sitelink a
{
text-decoration:none;
}

Resources