Freigeben über


WebMatrix Helpers (Part 2)

This post provides details and code syntax about the helpers provided in WebMatrix (Beta).

This post continues from an early post that describes other WebMatrix helpers. Here, I'm providing information about the following helpers:

· Chart

· Crypto

· ObjectInfo

· WebCache

· WebGrid

 

WebMatrix Helpers help you add common functionality to your Web site. Note - the syntax includes ALL the members for each helper.

Helper

Description

Syntax

Chart

Adds a series of values to the chart. For addition information, see the WebMatrix ASP.NET API Quick Reference.

Chart.AddChartArea(name, area3DStyle, axisX, axisY, axisX2, axisY2, options)

Chart.AddLegend(name, title, options)

Chart.AddSeries(name, chartType, chartArea, axisLabel, legend, markerStep, xValue, xField, yValues, yFields, options)

Chart.AddTitle(text, name, options)

Chart.Chart(width, height, templatePath, options)

Chart.CreateAxis(name, title, labelStyle, majorGrid, minorGrid, options)

Chart.DataBindCrossTable(dataSource, groupByField, xField, yFields, otherFields, pointSortOrder)

Chart.DataBindTable(dataSource, xField)

Chart.GetBytes(format)

Chart.GetFromCache(key)

Chart.Save(path, format)

Chart.SaveToCache(key, minutesToCache, slidingExpiration)

Chart.SaveXml(path)

Chart.SetBorder(SkinskinStyle, options)

Chart.ToWebImage(format)

Chart.Write(format)

Chart.WriteFromCache(key, format)

Chart.FileName

Chart.Height

Chart.Width

Crypto

Returns a hash for the specified data based on the selected the hash method. For addition information, see the WebMatrix ASP.NET API Quick Reference.

Crypto.MD5Hash(data) //data is a byte array

Crypto.MD5Hash(data) //data is a string

Crypto.SHA1(data) //data is a byte array

Crypto. SHA1 (data) //data is a string

Crypto.SHA256Hash(data) //data is a byte array

Crypto. SHA256Hash (data) //data is a string

ObjectInfo

Renders the properties and values of an object and any sub-objects. For addition information, see Chapter 14 - Introduction to Debugging.

ObjectInfo.Print(value, depth, enumerationLength)

WebCache

Gets or sets the object specified by key, or null if not found. For more information, see Chapter 12 - Caching to Improve the Performance of Your Website.

WebCache.Get(key)

WebCache.Remove(key)

WebCache.Set(key, value, minutesToCache, slidingExpiration)

WebGrid

Renders an HTML table that displays data, and supports options for formatting, for creating a way to page through the data, and for letting users sort just by clicking a column heading. For more information, see Chapter 5 - Working With Data.

WebGrid.Column(columnName, header, format, style, canSort)

WebGrid.Columns(columnSet)

WebGrid.GetContainerUpdateScript(path)

WebGrid.GetDynamicMember(obj, name)

WebGrid.GetHtml(tableStyle, headerStyle, footerStyle, rowStyle, alternatingRowStyle, selectedRowStyle, displayHeader, fillEmptyRows, defaultCellValue, columns, exclusions, mode, firstText, previousText, nextText, lastText, numericLinksCount)

WebGrid.GetPageUrl(pageIndex)

WebGrid.GetSortUrl(column)

WebGrid.Pager(mode, firstText, previousText, nextText, lastText, numericLinkdsCount)

WebGrid.Table(tableStyle, headerStyle, footerStyle, rowStyle, alternatingRowStyle, selectedRowStyle, displayHeader, fillEmptyRows, defaultCellValue, columns, exclusions, footer)

WebGrid.WebGrid(source, columnNames, defaultSort, rowsPerPage, canPage, canSort, ajaxUpdateContainerId, fieldNamePrefix, pageFieldName, selectionFieldName, sortFieldName, sortDirectionFieldName)

WebGrid.AjaxUpdateContainerId

WebGrid.ColumnNames

WebGrid.DataSource

WebGrid.FieldNamePrefix

WebGrid.HasSelection

WebGrid.PageCount

WebGrid.PageFieldName

WebGrid.PageIndex

WebGrid.Rows

WebGrid.RowsPerPage

WebGrid.SelectedIndex

WebGrid.SelectedRow

WebGrid.SelectionFieldName

WebGrid.SortColumn

WebGrid.SortDirection

WebGrid.SortDirectionFieldName

WebGrid.SortFieldName

WebGrid.TotalCount

Of course, the above table is related to WebMatrix BETA. The API may be updated. For additional syntax information, see the WebMatrix ASP.NET API Quick Reference.

Let me know if you are interested in examples or more specific syntax information. I would be happy to provide additional posts.

 

-- Erik Reitan
ASP.NET User Education
This posting is provided "AS IS" with no warranties, and confers no rights.