从列创建哈希值

时间:2014-09-29 16:08:54

标签: asp.net hash datatable aspxgridview

我在ASP.NET中从ASPxGridView创建一个数据表:

我想生成“ItemId”列中所有项目的哈希值(这些是整数),并将此哈希值放在“PlanId”列(在所有行中)。任何帮助表示赞赏。

protected void Button1_Click(object sender, EventArgs e)
{
    ASPxButton button1 = sender as ASPxButton;
    ASPxPageControl pageControl = (ASPxPageControl)button1.NamingContainer;
    ASPxGridView ASPxGridView2 = (ASPxGridView)pageControl.FindControl("ASPxGridView2");

    DataTable ItemsTag = new DataTable();
    ItemsTag.Columns.Add("PlanId", typeof(int)); ---The type might be different-----(binary?)
    ItemsTag.Columns.Add("ItemNumber", typeof(int));
    ItemsTag.Columns.Add("ItemId", typeof(int));
    ItemsTag.Columns.Add("ManufacturerId", typeof(int));
    ItemsTag.Columns.Add("RetailerId", typeof(int));

    for (int i = 0; i < ASPxGridView2.VisibleRowCount; i++)
    {
        DataRow row = ItemsTag.NewRow();
        row["PlanId"] = -----Hash Value enter here -----("Hash Value");
        row["ItemNumber"] = ASPxGridView2.GetRowValues(i, "ItemNumber");
        row["ItemId"] = ASPxGridView2.GetRowValues(i, "ItemId");
        row["ManufacturerId"] = ASPxGridView2.GetRowValues(i, "ManufacturerId");
        row["RetailerId"] = ASPxGridView2.GetRowValues(i, "RetailerId");
        ItemsTag.Rows.Add(row);
    }

    //Copy the data
    CopyData(ItemsTag);
}

0 个答案:

没有答案