WebMatrix :: Custom Message In Empty WebGrid?
Mar 29, 2011I want to show custom message when no data is present to display in WebGrid.
View 2 RepliesI want to show custom message when no data is present to display in WebGrid.
View 2 Repliesright now I playing around with WebMatrix and I followed the tutorial from http://www.asp.net/WebMatrix. Chapter 6 (displaying data in a grid) described how to use a WebGrid helper very clear, but the data in the example is always retrieved from an SQL DB.I want to use the same XML file from chapter 7 (Displaying data in a chart).Using the code:
...
var DataSet = new DataSet();
dataSet.ReadXmlSchema(Server.MapPath("/App_Data/QCFiler.xsd"));
[code]...
In the example code, you show how to use the rowId in a hyperlink to a detail page like this:
[Code]....
How do you do this with a WebGrid helper?
Is there a way to format a column with an image?
View 3 RepliesIs there a way to have a calculated column (field) in a webGrid in webMatrix?
View 4 RepliesI've been practicing with WebMatrix and I've come across this problem. I'd like to use the format property of the WebGrid Column in vbhtml but I can't get it to work. I always get some kind of compilation error. Mostly the compiler says that an expression is needed. There must be a crucial difference between the way it's done in cshtml and the way it's done in vbhtml.
View 9 RepliesMy webGrid is working perfectly fine. However, I would like the default sort order to be in the opposite direction. If it were SQL, I'd be adding a DESC somewhere. Here's my working line of code:
[Code]....
It correctly sorts on the UWDate column, but I would like it to sort the opposite sort order. Of course, once it is displayed, you can click on the title and it will resort at that time.
Just in general, where can I find the code to take a look at and learn from them? Or at least look at the functions available to me as I do get the feeling that the insufficient documentation at the moment reveals all.
View 5 RepliesI have a little web app derived from one template (LinkDirectory). It works fine both on local and on live website.
But, when I download the database (which is filled with valud data, visible in the web app) from the website data (for maintenance purposes), it appear empty (no tables) in my local wite.
What did I miss ? is there a better way to get the database back home ?
based on the code below how can I tell if the recordset returned is empty and if the grid is emptyIf data is empty how can I tell data.Count(); and data.RecordCount(); generate errorsHow can I tell if the grid is empty, has no rows or if the rowcount = 0
var db = Database.Open("StarterSite");
var sqlQ = "SELECT * FROM table1 ORDER BY Name";
var data = db.Query(sqlQ);
var grid1 = new webgrid(data);
grid1.gethtml();
When I click on the Alphabets it will show the details of a player...however, when that particular letters has no details of the player..I want to show."No results can be found"..Is there anyway to do it?
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState["CurrentAlphabet"] = "ALL";
this.GenerateAlphabets();
[code]...
What is the proper way to check for null or empty strings on dynamic objects? This is the only solution I've found so far:
if (admin.PasswordHash.GetType() == typeof(DBNull) || admin.PasswordHash == string.Empty)
If the field is null, the object returned is DBNull.Value, but if the field is empty string, it's return as a System.String object. This makes it impossible to do regular "admin.PasswordHash == DBNull.Value" check, as that will fail whenever the field has been set to empty string. Is my example the right (and only) way to go?
i created a custome control wit the following code.
[Code]....
from aspx page, when i click the link button to get the data in my composite control.
i get an empty Fields.
I have tried in many way but the error message for custom validator is not shown in validation summary but it(ValidationSummary) shows error message for every other type of validator.
[code]....
How does one create new sites in your own custom directory? Can it be added as a feature?
View 2 Repliesi'm using DataList to show records on Client Site of My web page i need to show a message when my DataList is empty .... is there a property of Datalist... How to show that message ?
View 1 Repliesi have a dropdownlist that bind with sqldatasource1. everytime i load this page, dropdownlist will display directly the content of data.
However, what i want is display empty message like --Please select your currency-- by default.
i want if there wasn't any thing to show in datalist it show some text in datalist like
"there isn't any thing to show" how i can do it?
How to setĀ letterĀ NO in gridview is empty record...
View 1 RepliesI am working on a website that draws fractals on the screen. It was my intention that with a right mouse click the picture could be saved to the visitor's computer. But that I get an error message "filetype blocked".The file is called test.jpg and is drawn to the screen as a bitmap. Could anybody tell me how to 'unblock' the right mouse click so that a visitor can save a picture he or she likes?Maybe it would be possible to let people download the image? But how would that work?
View 3 RepliesI've found a Webmatrix help article that says MS Webmatrix "publishes the (SQL Server or MySQL) database by creating scripts that run in a database that has been created for you by your hosting provider." That is wonderful, except I can't get it to work when I'm trying to publish a MySQL database (backing wordpress) through FTP (my hosting provider does not support 'web deploy'). Again, no problem, since it is already documented that " FTP protocols cannot be used to publish MySQL database. " But this does not excuse Webmatrix from generating MySQL database install scripts for me. During the publishing step, no database install script is generated - at least that I can tell - and there is no manual option to create a database export / backup / install script.
In short, as Webmatrix goes, I'm dead in the water trying to get my database uploaded to my hosting provider. Does anyone know the trick to force Webmatrix to create the MySQL database install scripts on my local box? Once created, I can take-over the upload and install process.
I'm wondering if it is possible to include Microsoft.Data.Entity.CTP.dll reference to WebMatrix site and if the Compact edition of the database would support it? I'd kinda love use something like
code-first development in my WebMatrix project. I think is even easier than writing SQL-s into the code...
I was wondering if someone could point me in the right direction:
How do I generate a custom error page with the error message and get it to mail me that error message?
Is there a good tutorial out there that someone could point me 2.
I started the Bakery site demo...everything runs fine on my local machine.When I publish the site to production server in w2k8r2+iis7.5 and with .net 4.0 (integrate) pool, my bakery apps not able to connect to the .sdf file.
Error I got is :
Connection string "bakery" was not found. Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: Connection string "bakery" was not found.
Source Error:
Line 2: Layout = "_SiteLayout.cshtml";
Line 3:
Line 4: FacebookSocialPlugins.Initialize("[xxx]", "[xxx]","bakery");
Line 5:
Line 6: }
Stack Trace:
[InvalidOperationException: Connection string "bakery" was not found.]
WebMatrix.Data.Database.OpenNamedConnection(String name, IConfigurationManager configurationManager) +132
WebMatrix.Data.Database.Open(String name) +42
System.Web.WebPages.DatabaseConnectionInfo.Connect() +43
System.Web.WebPages.SimpleMembershipProvider.CreateTablesIfNeeded() +42
System.Web.WebPages.WebSecurity.InitializeMembershipProvider(SimpleMembershipProvider sMembership, DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean createTables) +70
System.Web.WebPages.WebSecurity.InitializeProviders(DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables) +51
System.Web.WebPages.WebSecurity.InitializeDatabaseConnection(String connectionStringName, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables) +52
FacebookSocialPlugins.InitializeMembershipProviderIfNeeded() +54
FacebookSocialPlugins.Initialize(String appId, String appSecret, String membershipDbName) +171
ASP._PageStart_cshtml.Execute() in d:xxxakery\_PageStart.cshtml:4
System.Web.WebPages.StartPage.ExecutePageHierarchy() +15
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +33
System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContext context) +207
I know we can use the HTML helpers, but how about the strongly typed one's?
Html.LabelFor()