Wednesday, January 27, 2010

Dictionary on C#

this will get a mapping for values of page names and attach the resource to redirecto to each value.

string previousPage = Request.QueryString["Src"];
string DP = Request.QueryString["DP"];
var dictionary = new Dictionary();
dictionary["AccountingDetail"] = "AccountingDetail.aspx?DP="+DP;
dictionary["Fixing"] = "Fixing.aspx";
dictionary["Payment"] = "Payment.aspx";

if (dictionary.TryGetValue(previousPage, out pageMap ))
{
Response.Redirect(pageMap );
}

and here is the data format when you want to pass a datetime value in de parameters of an url from a source page:

DataNavigateURLFormatString="MyPage.aspx?product={0}&category={1}&date={2:d}"





No comments: