Jul 21, 2009

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<ContactManager.Models.Contact>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<title>Index</title>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">


<table class="data-table" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th class="actions edit">
Edit
</th>
<th class="actions delete">
Delete
</th>
<th>
Name
</th>
<th>
Phone
</th>
<th>
Email
</th>
</tr>
</thead>
<tbody>
<% foreach (var item in Model)
{ %>
<tr>
<td class="actions edit">
<a href='<%= Url.Action("Edit", new {id=item.Id}) %>'><img src="../../Content/Edit.png" alt="Edit" /></a>
</td>
<td class="actions delete">
<a href='<%= Url.Action("Delete", new {id=item.Id}) %>'><img src="../../Content/Delete.png" alt="Delete" /></a>
</td>
<th>
<%= Html.Encode(item.FirstName) %>
<%= Html.Encode(item.LastName) %>
</th>
<td>
<%= Html.Encode(item.Phone) %>
</td>
<td>
<%= Html.Encode(item.Email) %>
</td>
</tr>
<% } %>
</tbody>
</table>
<div class="divContactList-bottom">&nbsp;</div>
</asp:Content>


Jan 7, 2008

thrown: 'Dropdownlist1' has a SelectedValue which is invalid because it does not exist in the list of items.

Using GridView, I found .NET 2.0 is more efficient than .NET1.1
Expecially on GridView instead of DataGrid.

Recently, I found an error when I using a GridView which contains child control DropDownList. The DropDownList definition is:


Dec 26, 2007

Insert Table Using Trigger

insert 表
select * from
OPENROWSET('MICROSOFT.JET.OLEDB.4.0'
,'Excel 8.0;IMEX=1;HDR=YES;DATABASE=c:\test.xls' --c:\test.xls是excel文件名
,sheet1$) --sheet1$是工作表名+$

alter Trigger CheckandExist on temp_employee_info

for insert,delete,update

as

if not exists (select * from deleted)

if not exists (select * from employee_info where employee_info.CDSID=(select CDSID from inserted))

insert employee_info(CDSID,Name,Email) select CDSID,Name,Email from inserted
else

update employee_info
set
employee_info.Name=(select Name from inserted),
employee_info.Email=(select Email from inserted)


where
employee_info.CDSID=(select CDSID from inserted)

Oct 10, 2007

如何找到控件的父控件

Code Enough...

TabContainer myTabContainer=(TabContainer)this.Parent.Parent.FindControl("TabContainer1");
myTabContainer.ActiveTabIndex=4;
User Control Level
System.Web.UI.UserControl myASCX = new System.Web.UI.UserControl();
myASCX = (System.Web.UI.UserControl)this.Parent.FindControl("A1");
TextBox myTextBox;
myTextBox = (TextBox)myASCX.FindControl("TextBox1");

Sep 28, 2007

[转]安装.NET2.0后运行出现Failed to access IIS metabase错误解决办法.

笔者以前安装的是.NET1.1,后再在安装.NET 2.0后,无法再正常使用.出现

Failed to access IIS metabase

的错误,用自由微软的方法也无法解决.后来用以下办法成功解决问题:

1.在电脑管理里删掉ASPNET用户.

2.卸掉ASP.NET 2.0

3.卸掉IIS.

4.重装IIS,重装NET2.0

测试通过.

估计是ASPNET用户没有成功将权限分配给ASP.NET 2.0所至.但不明白为什么用微软的办法重新注册也解决不了,一定要重新安装.

感谢:denjackson