logMsg : failed to insert log entry
INSERT into cmslog (log_user,log_session,log_code,log_msg,log_ip,log_host,log_ts) VALUES ('guest','nhko2mvdc3nn8k9k4gqrfbvkk1','iLOGIN01','guest logged in','44.220.245.254','ec2-44-220-245-254.compute-1.amazonaws.com','2024-03-19 07:02:16')
Table './n-vision/cmslog' is marked as crashed and last (automatic?) repair failedlogMsg : failed to insert log entry
INSERT into cmslog (log_user,log_session,log_code,log_msg,log_ip,log_host,log_ts) VALUES ('guest','nhko2mvdc3nn8k9k4gqrfbvkk1','iCMSctrl','cndetail executed - id = 1124 (Eenvoudig gebruik maken van .NET Culture)','44.220.245.254','ec2-44-220-245-254.compute-1.amazonaws.com','2024-03-19 07:02:16')
Table './n-vision/cmslog' is marked as crashed and last (automatic?) repair failed NerdZ4ever - Eenvoudig gebruik maken van .NET Cultureinfo & LINQ naar een combobox
NerdZ 4 Ever Slimspel.nl
3892902 | guest | V2.62


Search :     Cat.   order 

Eenvoudig gebruik maken van .NET Cultureinfo & LINQ naar een combobox

v4| by enierop on 2009-06-18 11:53:44    (5111) rating
0

Ik zie nog best vaak, dat programmeurs datum gerelateerde comboboxjes vullen met ingetypte data.

 

Dit voorbeeld is lekker flexibel en werkt mee met de UICulture in

web.Config

<globalization uiCulture="nl-nl"/>

 

using System;

using System.Collections.Generic;

using System.Web;

using System.Linq;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Threading;

public partial class _Default : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

        int monthNumber = 0;

 

        var myMonthnames = Thread.CurrentThread.CurrentUICulture.DateTimeFormat.MonthNames

            .Select(p => new { monthNo = ++monthNumber, monthName = p.ToLower() });

 

        ddlMonthnames.DataTextField = "monthName";

        ddlMonthnames.DataValueField = "monthNo";

        ddlMonthnames.DataSource = myMonthnames;

        ddlMonthnames.DataBind();

    }

}

 

Het resultaat in HTML ziet er zo uit.

<select name="ddlMonthnames" id="ddlMonthnames">

<option value="1">januari</option>

<option value="2">februari</option>

<option value="3">maart</option>

<option value="4">april</option>

<option value="5">mei</option>

<option value="6">juni</option>

<option value="7">juli</option>

<option value="8">augustus</option>

<option value="9">september</option>

<option value="10">oktober</option>

<option value="11">november</option>

<option value="12">december</option>

<option value="13"></option>

</select>

only registered users can view responses

Other articles in Development

TitleCreatedBy
Construct 22015-02-24a3
Adobe cancels Flash on iPhone (and iPad)2010-04-21a3
Scratch - Imagine, program , share2009-10-31a3
Dr Dobbs challenge2009-03-03a3
Firefox Throttle2009-01-19Rachid
trailing slash ?2008-11-27Rachid
WMI Administrative Tools2008-11-20Rachid
Toetsenborden afluisteren2008-10-21Rachid
Complete websites te koop2008-10-13Rachid
WinBinder2008-10-03Rachid
SQLite Manager2008-07-16Rachid
Jonge uitvinders2008-05-25Rachid
Crowdsourcing met Cambrian House2008-05-21Rachid
Dates in PHP and MySQL2008-03-10Rachid
Google coding rules of engagement2008-03-03r g
Flash Photo Stack2008-02-19Rachid
Hot or not voor echte nerds2008-02-08eric
De performance van een overheids website, DenHaag.nl2008-01-25enierop
OpenID2008-01-24Rachid
Viewdle2008-01-20Rachid