Blog Home  Home Feed your aggregator (RSS 2.0)  
My DasBlog! - ASP.NET
newtelligence powered
 
Friday, July 01, 2005 12:55:41 PM (GMT Daylight Time, UTC+01:00)  #    Comments [2]   ASP.NET | C#  | 
# Thursday, June 09, 2005

Patrick Tisseghem was going to speak about SharePoint site definitions and templates on the TechEd 2005 in Amsterdam, but his session agenda has changed. He will be speaking about another very interesting session:

Creating Dynamic Web Sites with ASP.NET 2.0 Web Parts
"Drill down on the new Web Parts infrastructure in ASP.NET 2.0. Learn how you can use Web Parts to build rich Web sites-enabling end users to dynamically control the layout of pages-and customize the properties of server controls."

We already had a session internally about this subject given by Mart. I will certainly be there as SharePoint Geek! :)

http://blog.u2u.info/DottextWeb/patrick/archive/2005/06/09/4311.aspx

Thursday, June 09, 2005 7:56:33 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   .NET | ASP.NET  | 
# Monday, May 23, 2005
This weekend i needed a control to show jpeg images based on a folder structure. I decided to create an UserControl and used the Table, TableRow, TableCell, LinkButton and Image classes for generating the view. You could also use a class derived from System.Web.UI.Control and override the Render method for rendering the html.

This control is just an example of how to create your own ImageFolderViewer class. It does not take into account that the images could be portrait or landscape format. So if you need more functionality you have to make the additional changes yourself or wait till i release a better version.

Monday, May 23, 2005 9:36:26 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   ASP.NET | C#  | 
# Thursday, May 12, 2005
This is a very simple example how to transform a Webform.aspx file to a wizard. It contains two buttons and works even when the back and next button of the browser are used...
Thursday, May 12, 2005 12:53:22 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   ASP.NET | C#  | 
# Tuesday, May 10, 2005
When you use properties you only have a few possibilities. Checkboxes are used for booleans, Text fields are used for doubles, int, strings, etc and a dropdownlist is used for enumerations.

So why not create your own ToolPart with default and/or your own controls? It is even not that difficult. :)

I'm working on a BirthdayWebPart which needs some functionality to select through a dropdown box the contact list. But only enumerations are shown using a dropdown list. So we have to write our own ToolPart...

Tuesday, May 10, 2005 10:49:44 AM (GMT Daylight Time, UTC+01:00)  #    Comments [8]   ASP.NET | C# | SharePoint  | 

I found a great article on SharePoint Thoughts posted by pBoy about adding a custom ASP.NET application into a site template. It describes in a few steps how to do this. Some knowlegde is needed because you will be modifying the ONET.XML. Follow the link below for the whole article:

http://www.bluedoglimited.com/SharePointThoughts/ViewPost.aspx?ID=167

Tuesday, May 10, 2005 7:36:31 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   ASP.NET | SharePoint  | 
# Thursday, April 28, 2005

I expect that there are a lot of people who already wrote some knowlegde article about this. But it never hurts to explain it again. When you use Response.Transmitfile for transmitting a file to the client it gets the name of the current aspx file.

So how do you set the default name of the file which is downloaded to the client? It is actually very easy. The following code downloads a word file "rapport.doc" to the client:

string pathFileName = @"c:\documents\rapport.doc";
string fileName = System.IO.Path.GetFileName(pathFileName);

Response.ContentType = "application/msword";
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
Response.TransmitFile(pathFileName);

Thursday, April 28, 2005 3:41:31 PM (GMT Daylight Time, UTC+01:00)  #    Comments [3]   ASP.NET | C#  | 
# Saturday, April 23, 2005
I like to use singletons in my applications, especially when i don't want to initialise a class all the time when i need it. The idea behind a singleton class is to get an instance by calling a static member method and not be able to instantiate the class yourself. In that way there will only be one instance of the class during the run of the application...
Saturday, April 23, 2005 5:20:55 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0]   ASP.NET | C#  | 
# Monday, December 05, 2005

I always forget the exact order in which events fire. So i found the following when i googled and wanna share it with you all :)

Page.Init + Control.Init for every control on the Web Form
The first stage in the page life cycle is initialization. After the page's control tree is populated with all the statically declared controls in the .aspx source the Init event is fired. First, the Init event for the Page object occurs, then Init event occurs for each control on the Page. Viewstate information is not available at this stage.

Page.LoadViewState
After initialization, ASP.NET loads the view state for the page. ViewState contains the state of the controls the last time the page was processed on the server.

Page.ProcessPostData
Post Data gets read from the request and control values are applied to control initalized in stage 1.

Page.Load + Control.Load for each control on the Page
If this is the first time the page is being processed (Page.IsPostback property), initial data binding is performed here.

"Change" events are fired for controls
(TextChanged, SelectedIndexChanged, and similar) The current value (from Post Data) is compared to the original value located in the ViewState. If there is a difference "Changed" events are raised.

Server-side events are fired for any validation controls
Button.Click + Button.Command
The Click and Command events are fired for the button that caused the postback

Page.PreRender + Control.PreRender

Page.SaveViewState
New values for all the controls are saved to the view state for another round-trip to the server.

Page.Render

Monday, December 05, 2005 1:09:45 PM (GMT Standard Time, UTC+00:00)  #    Comments [5]   ASP.NET | C#  | 
# Friday, July 01, 2005

 If you use for example a Repeater and you do not want to show some field from the DataSource based on a expression, you could use the following solution. This example hides the year when the year in the DataSource is zero.

<asp:Repeater runat="server" id="rptGroup">
   <HeaderTemplate>
      <table>
   </HeaderTemplate>
   <ItemTemplate>
      <tr><td>
         <asp:Label id="lbl" runat="server" 
            Visible='<%#DisplayYear(DataBinder.Eval(Container.DataItem, "year"))%>'>
            <%#DataBinder.Eval(Container.DataItem, "year")%>
         </asp:Label>
      </td></tr>
   </ItemTemplate>
   <FooterTemplate>
      </table>
   </FooterTemplate>
</asp:Repeater>

In the code-behind the following method is added:

public bool DisplayYear(object item)
{
   int year = 0;

   try
   {
      year = Convert.ToInt32(item);
   }
   catch(exception)
   {
   }

   return year != 0;
}

<%#DataBinder.Eval(Container.DataItem, "wi_area")%>
<%#DataBinder.Eval(Container.DataItem, "wi_year")%><%#DataBinder.Eval(Container.DataItem, "co_name")%><%#DataBinder.Eval(Container.DataItem, "wi_amount")%><%#DataBinder.Eval(Container.DataItem, "wi_price", "{0:f}")%>
Copyright © 2012 Alexander Meijers. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: