比如我有如下DataGrid商品种类 商品名称 单位 单价 数量 总价
水果 苹果 斤 2.5 7 17.5
水果 香蕉 斤 1.5 3 4.5
烟 555 包 9.5 1 9.5然后当我点击项任意地方的时候在Text1中显示其对应的商品名称
这个动作在要前台完成
谢谢
水果 苹果 斤 2.5 7 17.5
水果 香蕉 斤 1.5 3 4.5
烟 555 包 9.5 1 9.5然后当我点击项任意地方的时候在Text1中显示其对应的商品名称
这个动作在要前台完成
谢谢
{
if(e.Item.ItemIndex>-1)
{
e.Attributes.Add("onclick","selectOne(this);"); } }
------------
function selectOne(obj)
{
document.getElementById('Text1').value = obj.cells[1].innerText;
}
{
document.getElementById ("TextBox1").value=s
}
private void DataGrid1_ItemDataBound_2(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if (e.Item .ItemType !=ListItemType.Header||e.Item .ItemType !=ListItemType.Footer )
e.Item .Attributes .Add ("onclick","checkone("+e.Item .Cells [1].Text +")");
}
{
if(e.Item.ItemIndex>-1)
{
e.Attributes.Add("onclick","selectOne(this);"); } }
------------
function selectOne(obj)
{
document.getElementById('Text1').value = obj.cells[1].innerText;
}
是用JavaScript脚本实现的是这样吗?
楼主不厚道,把我的答案copy一下都给分...