开发者

Creating a GridView Based Week to View Control

I am trying to build a simple booking application for a school开发者_运维知识库 presented as a WebPart that pulls data from several SPLists for existing bookings, recurring (timetabled) bookings and a list of available rooms used as a filter.

I admit from the outset that ASP.net isn't my strong point, I am more inclinded to use Console and WinForms projects, however I am willing to learn. The data access parts of the project are simple enough I can pull data and schema from the lists and spit it out. I am struggling with the interactive presentation component implemented with ASP.net and WebParts.

The way it is meant to look is something similar to this.

         Monday | Tuesday | Wednesday | Thursday | Friday
Period 1  Book  |  Book   |    Book   |   Book   |  Book
Period 2  Book  |  Book   |  Unavail. |   Book   |  Book
Period 3  Book  |  Book   |    Book   | Unavail. |  Book
Period 4  Book  |  Book   |    Book   |   Book   |  Book
Period 5  Book  |  Book   |    Book   |   Book   |  Book

My plan so far has been to implement the above as a single System.Web.UI.UserControl that would DataBind to a data structure, then possibly trigger events on click to check that they item is still available and make the booking.

I am struggling to get my head round the best way to do this there seem to be many ways to acheive the goal none of them seem particuarly elegant, I feel that I am missing something. I would gladly accept any pointers and suggestions as to a good way to attack this project.


If you want to use out-the-box controls from visual studio, you can use 2 repeaters (one nested in the other) to create the grid. You can use any other controls within the grid using the OnItemCommand event on the repeaters to catch the events on those controls (using CommandName and CommandArgument properties on the controls)

This will certailnly work and will be a good exercise in learning more about asp.net. You can build this into your own generic UserControl if required.


Not necessarily better than the repeater suggestion, but another option is to use a GridView control and a DataTable data structure. Your first column in both would be a "Row Header" column where you would put in "Period1, Period2, etc."

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜