Wiezewazoel
Programmer
i don't know if it really belongs here but i think it does,
The problem is: (i'm making a 'time table' where u can see the progress of a project. Example: Example)
i have 2 update panels (upOuter and upInner).
In the outer one the user chooses a month and year with numericupdown extender
when this person does this, i would like the inner update panel to update his table if the month or year changes.
Don't worry about the table itself, i'm not there yet, i first want to try altering the table.
What it does now: it does change the table but it dissapears like after a second! or sometimes, it stays but not always... and also the browser sais i have an error :s
i have no idea why the table inside the inner Update panel just dissapears for no reason
Code:
THE .aspx page!
The .aspx.cs page
don't mind the dutch things, its just month and year, then i want to convert back to the number of the month
The problem is: (i'm making a 'time table' where u can see the progress of a project. Example: Example)
i have 2 update panels (upOuter and upInner).
In the outer one the user chooses a month and year with numericupdown extender
when this person does this, i would like the inner update panel to update his table if the month or year changes.
Don't worry about the table itself, i'm not there yet, i first want to try altering the table.
What it does now: it does change the table but it dissapears like after a second! or sometimes, it stays but not always... and also the browser sais i have an error :s
i have no idea why the table inside the inner Update panel just dissapears for no reason
Code:
THE .aspx page!
Code:
<%@ Page Language="C#" MasterPageFile="~/Masterpage/KronosMasterPage.master" AutoEventWireup="true" CodeFile="ToonVordering.aspx.cs" Inherits="Site_ToonVordering" Title="Untitled Page" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Label ID="lblWelkomBericht" runat="server"></asp:Label>
<br />
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<br />
Kies een project:
<asp:DropDownList ID="ddlProjecten" runat="server" AutoPostBack="True"
onselectedindexchanged="ddlProjecten_SelectedIndexChanged">
</asp:DropDownList>
<br />
<br />
<asp:Panel ID="pnlVordering" runat="server" Visible="False">
<asp:UpdatePanel ID="upOuter" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<p>
<span class="LoginSpan">Kies een maand:</span>
<asp:ImageButton ID="btnLinksMaand" runat="server" ImageUrl="~/Images/Left.jpg" />
<asp:TextBox ID="txtMaand" runat="server" ontextchanged="TextChanged" AutoPostBack="true"></asp:TextBox>
<asp:ImageButton ID="brnRechtsMaand" runat="server" ImageUrl="~/Images/Right.jpg" />
</p>
<p>
<span class="LoginSpan">Kies een jaar:</span>
<asp:ImageButton ID="btnLinksJaar" runat="server" ImageUrl="~/Images/Left.jpg" />
<asp:TextBox ID="txtJaar" Text="2008" runat="server" ontextchanged="TextChanged" AutoPostBack="true"></asp:TextBox>
<asp:ImageButton ID="btnRechtsJaar" runat="server" ImageUrl="~/Images/Right.jpg"/>
</p>
<asp:UpdatePanel ID="upInner" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Table ID="tblVordering" runat="server" Width="736px">
</asp:Table>
</ContentTemplate>
</asp:UpdatePanel>
<cc1:NumericUpDownExtender ID="nudMaand" runat="server"
TargetControlID="txtMaand"
Width="120"
RefValues=""
ServiceUpPath=""
ServiceDownPath=""
ServiceUpMethod=""
ServiceDownMethod=""
TargetButtonUpID="brnRechtsMaand"
TargetButtonDownID="btnLinksMaand">
</cc1:NumericUpDownExtender>
<cc1:NumericUpDownExtender ID="nudJaar" runat="server"
TargetControlID="txtJaar"
Width="120"
RefValues=""
ServiceUpPath=""
ServiceDownPath=""
ServiceUpMethod=""
ServiceDownMethod=""
TargetButtonUpID="btnRechtsJaar"
TargetButtonDownID="btnLinksJaar">
</cc1:NumericUpDownExtender>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<br />
<asp:Label ID="lblFeedback" runat="server"></asp:Label>
<br />
</asp:Content>
The .aspx.cs page
Code:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using KronosProject.Domain;
using System.Collections.Generic;
using System.Globalization;
public partial class Site_ToonVordering : System.Web.UI.Page
{
#region Attributen
private Medewerker _gebruiker = null;
private Project _project = null;
private int _maand = 0;
private int _jaar = 0;
#endregion
#region Page Load
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.Master.Page.Header.Title = "KronosProject : Projectbeheer";
_gebruiker = (Medewerker)Session["Gebruiker"];
lblWelkomBericht.Text = "Welkom, " + _gebruiker.Famnaam + " " + _gebruiker.Voornaam;
VulDDLProjecten();
List<Vordering> vorderingen = ToonVorderingController.GetVorderingen(1);
}
else
{
if (Session["Project"] != null)
_project = (Project)Session["Project"];
if (Session["Maand"] != null)
_maand = (int)Session["Maand"];
if (Session["Jaar"] != null)
_jaar = (int)Session["Jaar"];
}
}
#endregion
#region Methoden
private void VulDDLProjecten()
{
try
{
ddlProjecten.DataSource = MaakPlanningController.GetProjecten(_gebruiker.ID);
ddlProjecten.DataTextField = "naam";
ddlProjecten.DataValueField = "ID";
ddlProjecten.DataBind();
ddlProjecten.Items.Insert(0, new ListItem("--Kies een project--", "0"));
}
catch (Exception ex)
{
lblFeedback.Text = ex.Message;
}
}
protected void ddlProjecten_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
if (ddlProjecten.SelectedValue != "0")
{
pnlVordering.Visible = true;
vulTextBox();
}
}
catch (Exception ex)
{
lblFeedback.Text = ex.Message;
}
}
private void vulTextBox()
{
nudMaand.RefValues = GetMaanden();
txtMaand.Text = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(DateTime.Now.Month);
}
private void vulTabel()
{
}
private String GetMaanden()
{
String maanden = "";
for (int i = 1; i < 13; i++)
{
if (i > 0 && i < 12)
maanden += CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i) + ";";
else
maanden += CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i);
}
return maanden;
}
#endregion
protected void TextChanged(object sender, EventArgs e)
{
if(((TextBox)sender).ID == "txtMaand")
{
TableRow test = new TableRow();
TableCell test2 = new TableCell();
switch(txtMaand.Text)
{
case "januari": _maand = 1; break;
case "februari": _maand = 2; break;
case "maart": _maand = 3; break;
case "april": _maand = 4; break;
case "mei": _maand = 5; break;
case "juni": _maand = 6; break;
case "juli": _maand = 7; break;
case "augustus": _maand = 8; break;
case "september": _maand = 9; break;
case "oktober": _maand = 10; break;
case "november": _maand = 11; break;
case "december": _maand = 12; break;
}
Session["Maand"] = _maand;
test2.Text = "" + _maand;
test2.ColumnSpan = 30;
test.Cells.Add(test2);
tblVordering.Rows.Add(test);
}
}
}
don't mind the dutch things, its just month and year, then i want to convert back to the number of the month