Hello Colin,
Thanks for your post. I reviewed your code carefully, however, I did not
find any known issue. In addition, I built a sample web page in Visual
Studio .NET 2002 and it works properly on my side. I post my my test code
below, please check it on your side.
I look forward to your response.
Have a nice day!
Regards,
HuangTM
Microsoft Online Partner Support
MCSE/MCSD
Get Secure! ¨C
www.microsoft.com/security
This posting is provided ˇ°as isˇ± with no warranties and confers no rights.
//------------------------WebForm3.aspx.cs---------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace WebApplication2
{
/// <summary>
/// Summary description for WebForm3.
/// </summary>
public class WebForm3 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataList DeployList;
protected System.Web.UI.WebControls.Button Button2;
ICollection CreateDataSource()
{
DataTable dt = new DataTable();
DataRow dr;
dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
for (int i = 0; i < 10; i++)
{
dr = dt.NewRow();
dr[0] = "Item " + i.ToString();
dt.Rows.Add(dr);
}
DataView dv = new DataView(dt);
return dv;
}
private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
DeployList.DataSource = CreateDataSource();
DeployList.DataBind();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.DeployList.UpdateCommand += new
System.Web.UI.WebControls.DataListCommandEventHand ler(this.DeployList_Update
Command);
this.Button2.Click += new System.EventHandler(this.Button2_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DeployList_UpdateCommand(object source,
System.Web.UI.WebControls.DataListCommandEventArgs e)
{
int PageLevel, ZoneID;
// ZoneID = int.Parse(e.CommandArgument.ToString());
TextBox PageLevelTB =
(TextBox)e.Item.FindControl("PageLevelTextBox");
if(PageLevelTB == null)
Response.Write("Fail to find control");
else
Response.Write(PageLevelTB.Text );
try
{
PageLevel = int.Parse(PageLevelTB.Text);
}
catch(Exception ex)
{
Controls.Add(new LiteralControl(ex.Message));
}
}
private void Button2_Click(object sender, System.EventArgs e)
{
DeployList.EditItemIndex = 1;
}
}
}
//--------------------------------end of-----------------------------
//------------------------------ WebForm3.aspx------------------
<%@ Page language="c#" Codebehind="WebForm3.aspx.cs"
AutoEventWireup="false" Inherits="WebApplication2.WebForm3" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm2</title>
<meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="WebForm2" method="post" runat="server">
<FONT face="arial">
<asp:datalist id="DeployList" style="Z-INDEX: 102; LEFT: 91px;
POSITION: absolute; TOP: 21px" runat="server"
AlternatingItemStyle-BackColor="Gainsboro" HeaderStyle-BackColor="#aaaadd"
Font-Size="8pt" Font-Name="Verdana" CellPadding="3" BorderColor="black">
<HeaderTemplate>
Items
</HeaderTemplate>
<AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "StringValue") %>
</ItemTemplate>
<HeaderStyle BackColor="#AAAADD"></HeaderStyle>
<edititemtemplate>
<div class="row">
<span class="label" style="width: 35%; text-align: left; ">
<%# DataBinder.Eval(Container.DataItem, "Title") %>
</span><span class="formw" style="width: 10%; ">
<asp:linkbutton commandname="update" commandargument='<%#
DataBinder.Eval(Container.DataItem,"ZoneID") %>' text="update"
runat="server" ID="Linkbutton1"/>
</span><span class="formw">Page:
<asp:textbox Text='<%# DataBinder.Eval(Container.DataItem,
"PageLevel")%>' size="2" id="PageLevelTextBox" runat="server" />
</span>
</div>
</edititemtemplate>
</asp:datalist>
<asp:button id="Button2" style="Z-INDEX: 103; LEFT: 290px; POSITION:
absolute; TOP: 37px" runat="server" Text="Button"></asp:button>
</FONT>
</form>
</body>
</HTML>
//------------------------------------------end
of------------------------------