Hi Pat,
Thank you for using the community. I am Luke and I am review this issue
currently. As I understand, you need three column in a web datagrid: one is
for a number and two button to increase/decrease the number. I compose such
a sample as following, you may refer to it:
Here is HTML code:
<asp

ataGrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 80px; POSITION:
absolute; TOP: 136px"
runat="server" Width="328px" Height="200px"
AutoGenerateColumns="False">
<Columns>
<asp:ButtonColumn CommandName="Increase" ButtonType="PushButton"
HeaderText="+" Text="Increase" />
<asp:ButtonColumn CommandName="Decrease" ButtonType="PushButton"
HeaderText="-" Text="Decrease" />
<asp:BoundColumn DataField="IntValue"
HeaderText="value"></asp:BoundColumn>
</Columns>
</asp

ataGrid>
Here is the C# code in codebehind:
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (!IsPostBack)
{
DataTable dt = new DataTable("MyTable");
dt.Columns.Add("IntValue",System.Type.GetType("System.Int16"));
DataRow dr= dt.NewRow();
dr[0]=1;
dt.Rows.Add(dr);
dr= dt.NewRow();
dr[0]=2;
dt.Rows.Add(dr);
DataGrid1.DataSource =dt;
DataGrid1.DataBind();
}
}
private void InitializeComponent()
{
this.DataGrid1.ItemCommand += new
System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_ItemCom
mand);
this.Load += new System.EventHandler(this.Page_Load);
}
private void DataGrid1_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
int ovalue;
ovalue=int.Parse(((TableCell)e.Item.Controls[2]).Text);
if (e.CommandName=="Increase")
{
((TableCell)e.Item.Controls[2]).Text=(ovalue+1).ToString();
}
else
{
((TableCell)e.Item.Controls[2]).Text=(ovalue-1).ToString();
}
}
The Key is we add two Buttoncloumns to datagrid and hand their click event
in datagrid's ItemCommand.
Hope this help,
Luke
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)