Search Results

Search found 4 results on 1 pages for 'moezmousavi'.

Page 1/1 | 1 

  • The Current week dates

    - by MoezMousavi
    The Current week dates Might be a bit vierd as we normaly not writing a multicultural web site. So not very frequently using CultureInfo however, it is  actully quite good to use it to get the week days.               CultureInfo info = Thread.CurrentThread.CurrentCulture;             DayOfWeek firstday = info.DateTimeFormat.FirstDayOfWeek;             DayOfWeek today = info.Calendar.GetDayOfWeek(DateTime.Now);               int diff = today - firstday;               DateTime firstDate = DateTime.Now.AddDays(-diff);             DateTime lastDate = firstDate.AddDays(6);

    Read the article

  • Repeater vs. ListView

    - by MoezMousavi
    I do really hate repeater. I was more a GridView lover but after 3.5 be born, I prefer ListView.  The first problem with Repeater is paging. You will need to write code to handle paging. Second common problem is empty data template. Have a look at this:             if (rptMyRepeater.Items.Count < 1)             {                 if (e.Item.ItemType == ListItemType.Footer)                 {                     Label lblFooter = (Label)e.Item.FindControl("lblEmpty");                     lblFooter.Visible = true;                 }             }   I found the above code is usefull if you need to show something like "There is no record" is your data source has no records. Although the ListView has a template.   If you combine ListView with a DataPager, you will be in heaven as it is sorting the paging for you without writing code. (http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datapager.aspx)     Note: You have got to bind ListView in PreRender, it doesn't work properly in PageLoad   More: http://www.4guysfromrolla.com/articles/061009-1.aspx

    Read the article

  • The life saver HttpContext.Current.Items["ParameterName"]

    - by MoezMousavi
    I got stocked passing parameter to one master page for some reasons, seems the page lifecycle and dynamic loading of the master pages has got some issues with defining public properties in the masterpage within my project. It did not set my values and as a result, properties became useless. A collegue just mentioned using HttpContext. have a look what  MSDN saying "Encapsulates all HTTP-specific information about an individual HTTP request" http://msdn.microsoft.com/en-us/library/system.web.httpcontext.aspx HttpContext.Current.Items["ParameterName"] Also, Page.Items could do the same thing. Page.Items, "Gets a list of objects stored in the page context" http://msdn.microsoft.com/en-us/library/system.web.ui.page.items.aspx as your master page and content page are rendered as a single document anyway.

    Read the article

1