我也希望用aspx网格做这样的事情。 创建Grid的对象并将其属性设置为后面的代码 这是针对asp网格
GridView obj1=(GridView)sender;
BoundField col = (BoundField)grid.Columns[1];
col1.DataFormatString="{0:N2}";
你的想法好吗?
如果您愿意进一步提供帮助,我将非常感谢您对我发布的这个问题的看法。我已经等了很久才得到一些关于这个问题的建议。
How to Set the column properties of DevEx Grid form code behind
答案 0 :(得分:0)
foreach (GridDataItem item in grdInvoiceItems.Items)
{
//object id = (object)item.OwnerTableView.DataKeyValues[item.ItemIndex]["Id"];
object value = item["Id"].Text;
id = (item["Id"].FindControl("lblId") as RadTextBox).Text;
string lineItem = (item["Item"].FindControl("ddlItems") as RadComboBox).Text;
string description = (item["Description"].FindControl("txtDescription") as RadTextBox).Text;
double? price = (item["Price"].FindControl("txtPrice") as RadNumericTextBox).Value;
double? qty = (item["Qty"].FindControl("txtQty") as RadNumericTextBox).Value;
double? discount = (item["Discount"].FindControl("txtDiscount") as RadNumericTextBox).Value;
//double tax = double.Parse(lblTaxes.Text);
//Label amount1 = (item["Amount"].FindControl("lblAmount") as Label);
//string amount = item["Amount"].Text;
//Label amount1 = (item.FindControl("lblAmount") as Label);
double? amounnt = (item["Amount"].FindControl("lblAmount") as RadNumericTextBox).Value;
if (!string.IsNullOrEmpty(lineItem))
{
Invoice.UpdateInvoiceItems(Convert.ToInt32(id), lineItem, description, Convert.ToDouble(price),
Convert.ToInt32(qty), Convert.ToDouble(discount), 0, Convert.ToDouble(amounnt));
}
}