Hi Smit,
Thanks for your followup. I've checked and found that the attachement seems
only avaliable in OE client. Would you please check the message in OE? Any
way, I've post the page's code here in case that you may got any
difficulties using the OE client:
-------------------------------aspx
page-------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>BindGrid </title>
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table width="100%" align="center">
<tr>
<td>
<asp:DataGrid id="dgMain" runat="server" AutoGenerateCol umns="False">
<Columns>
<asp:BoundColum n DataField="inde x"
HeaderText="Ind ex"></asp:BoundColumn >
<asp:BoundColum n DataField="name "
HeaderText="Nam e"></asp:BoundColumn >
<asp:BoundColum n DataField="desc ription"
HeaderText="Des cription"></asp:BoundColumn >
<asp:EditComman dColumn ButtonType="Lin kButton" UpdateText="Upd ate"
HeaderText="Ope ration" CancelText="Can cel"
EditText="Edit" ></asp:EditCommand Column>
</Columns>
</asp:DataGrid></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td></td>
</tr>
</table>
</form>
</body>
</HTML>
---------------------------------code behind page
class----------------------------------
public class BindGrid : System.Web.UI.P age
{
protected System.Web.UI.W ebControls.Data Grid dgMain;
private void Page_Load(objec t sender, System.EventArg s e)
{
if(!IsPostBack)
{
Load_Data();
Bind_Data();
}
}
protected void Load_Data()
{
DataTable tb = new DataTable();
tb.Columns.Add( "index");
tb.Columns.Add( "name");
tb.Columns.Add( "descriptio n");
for(int i=1;i<=10;i++)
{
DataRow row = tb.NewRow();
row["index"] = i.ToString();
row["name"] = "Name" + i.ToString();
row["descriptio n"] = "Descriptio n" + i.ToString();
tb.Rows.Add(row );
}
Session["TEMP_DATA"] = tb;
}
protected void Bind_Data()
{
DataTable tb = (DataTable)Sess ion["TEMP_DATA"];
dgMain.DataSour ce = tb;
dgMain.DataBind ();
((BoundColumn)d gMain.Columns[0]).ReadOnly = true;
}
#region Web Form Designer generated code
override protected void OnInit(EventArg s e)
{
InitializeCompo nent();
base.OnInit(e);
}
private void InitializeCompo nent()
{
this.dgMain.Can celCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gMain_CancelCom m
and);
this.dgMain.Edi tCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gMain_EditComma n
d);
this.dgMain.Upd ateCommand += new
System.Web.UI.W ebControls.Data GridCommandEven tHandler(this.d gMain_UpdateCom m
and);
this.Load += new System.EventHan dler(this.Page_ Load);
}
#endregion
private void dgMain_UpdateCo mmand(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
dgMain.EditItem Index = -1;
Bind_Data();
}
private void dgMain_CancelCo mmand(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
dgMain.EditItem Index = -1;
Bind_Data();
}
private void dgMain_EditComm and(object source,
System.Web.UI.W ebControls.Data GridCommandEven tArgs e)
{
dgMain.EditItem Index = e.Item.ItemInde x;
Bind_Data();
}
}
=============== =============== =============== ===
Please check it out and feel free to let me know if you still have any
problems on it.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx