Click here to Skip to main content
15,909,091 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Creating three DIVS, left and right fixed , center div scrolls Pin
starlimit039-Sep-14 3:10
starlimit039-Sep-14 3:10 
Question[ask] asp.net and IBM DB2 Pin
ricardo 308-Sep-14 18:10
ricardo 308-Sep-14 18:10 
AnswerRe: [ask] asp.net and IBM DB2 Pin
ZurdoDev9-Sep-14 6:54
professionalZurdoDev9-Sep-14 6:54 
AnswerRe: [ask] asp.net and IBM DB2 Pin
Sibeesh KV29-Sep-14 1:24
professionalSibeesh KV29-Sep-14 1:24 
QuestionBuilding OData Web API on the basis of other OData API instead of Database Pin
LiQuick8-Sep-14 0:01
LiQuick8-Sep-14 0:01 
AnswerRe: Building OData Web API on the basis of other OData API instead of Database Pin
Nathan Minier8-Sep-14 4:54
professionalNathan Minier8-Sep-14 4:54 
GeneralRe: Building OData Web API on the basis of other OData API instead of Database Pin
LiQuick8-Sep-14 9:39
LiQuick8-Sep-14 9:39 
Questiononsubmit event Pin
Ali Al Omairi(Abu AlHassan)7-Sep-14 21:07
professionalAli Al Omairi(Abu AlHassan)7-Sep-14 21:07 
AnswerRe: onsubmit event Pin
jkirkerx8-Sep-14 12:58
professionaljkirkerx8-Sep-14 12:58 
GeneralRe: onsubmit event Pin
Ali Al Omairi(Abu AlHassan)8-Sep-14 21:24
professionalAli Al Omairi(Abu AlHassan)8-Sep-14 21:24 
GeneralRe: onsubmit event Pin
jkirkerx9-Sep-14 4:22
professionaljkirkerx9-Sep-14 4:22 
QuestionSample code to post a asp.net forms data to third party API in XML input Pin
Roberts Techie7-Sep-14 19:07
Roberts Techie7-Sep-14 19:07 
GeneralRe: Sample code to post a asp.net forms data to third party API in XML input Pin
Kornfeld Eliyahu Peter7-Sep-14 20:51
professionalKornfeld Eliyahu Peter7-Sep-14 20:51 
GeneralRe: Sample code to post a asp.net forms data to third party API in XML input Pin
Richard MacCutchan7-Sep-14 21:27
mveRichard MacCutchan7-Sep-14 21:27 
GeneralRe: Sample code to post a asp.net forms data to third party API in XML input Pin
Kornfeld Eliyahu Peter7-Sep-14 21:57
professionalKornfeld Eliyahu Peter7-Sep-14 21:57 
GeneralRe: Sample code to post a asp.net forms data to third party API in XML input Pin
Richard MacCutchan7-Sep-14 22:15
mveRichard MacCutchan7-Sep-14 22:15 
AnswerRe: Sample code to post a asp.net forms data to third party API in XML input Pin
Bernhard Hiller7-Sep-14 22:06
Bernhard Hiller7-Sep-14 22:06 
QuestionHow to implement a Treeview / Form interface. Pin
Wierdbeard656-Sep-14 4:21
Wierdbeard656-Sep-14 4:21 
Hi,
First up, sorry if I haven't used the correct name for this interface style in the title. I'm not sure if there even is a correct name! What I am trying to do is to have a treeview on the left of the screen and an AJAX panel on the right. When a node is selected, a User Control is added to the panel (different controls depending on the type of the node).

This part works.

My problem is twofold.

1. If I select a node in the tree, the SelectedNodeChanged event fires, and causes the User Control to be correctly displayed. If, however, I click on the node that is already selected, the User Control disappears. I can only assume AJAX is updating the panel, but I can't figure out why. There doesn't appear to be an OnClick event for a TreeView..

2. When I click on the OK or Cancel buttons within my User Control, I want the postback to update my application and then leave the node selected with the User Control still displayed (Obviously, Cancel results in the contents being wiped...) Again, clicking the button causes the User Control to disappear.

Code:
Main Page
ASP.NET
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="HomeLink">
        <asp:HyperLink ID="HyperLink1" runat="server" CssClass="home" ImageUrl="~/Images/105329-3d-glossy-orange-orb-icon-business-home5.png"
            NavigateUrl="~/Default.aspx">
        </asp:HyperLink>
    </div>
    <asp:Panel ID="TreeArea" runat="server" CssClass="TreeArea">
        <%-- Here ExpandDepth="0" for eleminates the expansion of the added treenodes --%>
        <asp:TreeView ID="TreeViewSettings" runat="server" ExpandDepth="0" PopulateNodesFromClient="False"
            CssClass="TreeViewSettings" OnSelectedNodeChanged="TreeViewSettings_SelectedNodeChanged">
        </asp:TreeView>
    </asp:Panel>
    <asp:Panel ID="EditFormArea" runat="server" CssClass="SettingsFormArea">
        <asp:UpdatePanel ID="UpdatePanelEdit" runat="server">
            <ContentTemplate>
                <asp:Panel ID="PanelEdit" runat="server">
                </asp:Panel>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="TreeViewSettings" EventName="SelectedNodeChanged">
                </asp:AsyncPostBackTrigger>
            </Triggers>
        </asp:UpdatePanel>
    </asp:Panel>
</asp:Content>


C#
protected void TreeViewSettings_SelectedNodeChanged(object sender, EventArgs e)
{
    reload();
}
protected void reload(){
    TreeNode selection = TreeViewSettings.SelectedNode;
    string[] SelectedDetails = selection.Value.Split(new char[] {'|'});
    RegionEditor RegionEditorForm = LoadControl("~/TheSettings/RegionEditor.ascx") as RegionEditor;
    RegionEditorForm.RegionID = int.Parse(SelectedDetails[1]);
    RegionEditorForm.CancelClick += new EventHandler(RegionEditorForm_CancelClick);
    PanelEdit.Controls.Add(RegionEditorForm);
    AsyncPostBackTrigger CancelTrigger = new AsyncPostBackTrigger();
    CancelTrigger.ControlID = RegionEditorForm.UniqueID;
    CancelTrigger.EventName = "CancelClick";
    UpdatePanelEdit.Triggers.Add(CancelTrigger);
}
void RegionEditorForm_CancelClick(object sender, EventArgs e)
{
    reload();
}


User Control:
ASP.NET
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RegionEditor.ascx.cs"
    Inherits="Shedulinator.TheSettings.RegionEditor" %>
<% if (false)
   { %>
<link rel="Stylesheet" type="text/css" href="../Styles/Site.css" />
<% } %>
<asp:Image ID="Image1" runat="server" ImageUrl="~/Images/106660-3d-glossy-orange-orb-icon-transport-travel-compass2.png"
    CssClass="SettingsIcon" />
<asp:Panel ID="Panel1" runat="server" CssClass="SettingsFormPanel">
    <asp:Label ID="LabelRegion" runat="server" Text="Region Name:"></asp:Label>
    <asp:TextBox ID="TextBoxRegionName" runat="server"></asp:TextBox>
    <asp:Button ID="ButtonCancel" runat="server" CssClass="SettingsButton" 
        Text="Cancel" onclick="ButtonCancel_Click" />
    <asp:Button ID="ButtonOK" runat="server" CssClass="SettingsButton" Text="OK" 
        onclick="ButtonOK_Click" />
</asp:Panel>

C#
public partial class RegionEditor : System.Web.UI.UserControl
{
    public event EventHandler CancelClick;
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void ButtonCancel_Click(object sender, EventArgs e)
    {
        if (CancelClick != null)
        {
            CancelClick(this, new EventArgs());
        }
    }
}


Ideas, anyone?

Thanks!
AnswerRe: How to implement a Treeview / Form interface. Pin
jkirkerx6-Sep-14 12:30
professionaljkirkerx6-Sep-14 12:30 
GeneralRe: How to implement a Treeview / Form interface. Pin
Wierdbeard656-Sep-14 15:21
Wierdbeard656-Sep-14 15:21 
GeneralRe: How to implement a Treeview / Form interface. Pin
jkirkerx6-Sep-14 16:20
professionaljkirkerx6-Sep-14 16:20 
GeneralRe: How to implement a Treeview / Form interface. Pin
Wierdbeard6512-Sep-14 6:54
Wierdbeard6512-Sep-14 6:54 
QuestionNeed to POST xml data to web device w/ c# ASPX Pin
Member 110616635-Sep-14 5:36
Member 110616635-Sep-14 5:36 
QuestionAsp.net GridView with JQuery Pin
Member 106549793-Sep-14 20:41
Member 106549793-Sep-14 20:41 
QuestionRe: Asp.net GridView with JQuery Pin
ZurdoDev5-Sep-14 6:19
professionalZurdoDev5-Sep-14 6:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.