FineUI 官方论坛
标题:
js 增加记录时显示错误框
[打印本页]
作者:
yygy
时间:
2014-5-9 15:27
标题:
js 增加记录时显示错误框
本帖最后由 yygy 于 2014-5-9 15:30 编辑
<f:Button ID="Button1" runat="server" Text="增加记录" OnClientClick="gender45();"></f:Button>
<f:Grid ID="Grid2" Title="表格" ShowBorder="true" ShowHeader="false"
BoxFlex="1" runat="server" Width="800px" AllowCellEditing="true" ClicksToEdit="1">
<Columns>
<f:BoundField ColumnID="B0" Width="80px" Hidden="true" HeaderText="id" />
<f:RenderField ColumnID="B7" Width="100px" DataField="金额" FieldType="Float"
HeaderText="金额">
<Editor>
<f:TextBox ID="TextBox2" Required="true" runat="server">
</f:TextBox>
</Editor>
</f:RenderField>
</Columns>
</f:Grid>
<script type="text/javascript">
var Grid2;
F.ready(function () {
Grid2 = F('<%= Grid2.ClientID %>');
});
function gender45() {
var t = "{";
t += "'B0':'" + "22" + "',";
t += "'B7':'0.00'";
t += "}";
var jsonobj = eval('(' + t + ')');
Grid2.f_addNewRecord(jsonobj, false);
}
</script>
复制代码
IE11
当字段"B0" 的 Hidden="false" 又可以,为TRUE时不可以
作者:
boy221100
时间:
2014-5-10 15:47
Grid2 = F('<%= Grid2.ClientID %>');
是不是这边有问题
作者:
boy221100
时间:
2014-5-10 15:49
我写的合计,4.05下的
前台
<Columns>
<f:RowNumberField EnablePagingNumber="true" Width="30px" HeaderText="xh" />
<f:WindowField ColumnID="editField" TextAlign="Center" Icon="
encil" ToolTip="编辑" WindowID="Window1" Title="编辑" DataIFrameUrlFields="ID"
DataIFrameUrlFormatString="~/Voucher/VouchEdit.aspx?id={0}" Width="30px"></f:WindowField>
<f
inkButtonField ColumnID="Delete" HeaderText=" " Width="30px" CommandName="Delete" ConfirmText="是否删除!" Icon="Delete"></f
inkButtonField>
</Columns>
</f:Grid>
<f:HiddenField runat="server" ID="hfGrid1Summary"></f:HiddenField>
后台
private void BindGrid(string strWhere)
{
Grid1.DataSource = null;
string sortField = Grid1.SortField;
string sortDirection = Grid1.SortDirection;
// 1.设置总项数
Grid1.RecordCount = _bll.GetRecordCount(strWhere);
// 2.获取当前分页数据
int rowbegin = Grid1.PageIndex * Grid1.PageSize;
int rowend = (Grid1.PageIndex + 1) * Grid1.PageSize;
DataTable table = _bll.GetListByPage(strWhere, sortField + " " + sortDirection, rowbegin, rowend).Tables[0];
//DataTable table = GetPagedDataTable(Grid1.PageIndex, Grid1.PageSize);
// 3.绑定到Grid
//DataTable table = GetDataTable();
DataView view1 = table.DefaultView;
view1.Sort = String.Format("{0} {1}", sortField, sortDirection);
Grid1.DataSource = view1;
Grid1.DataBind();
//显示页小计
OutputPageSummaryData(table);
//DataTable source = _bll.GetList(strWhere).Tables[0];
// strHtml = GridHelper.FormatAsHtml(Grid1, source);
}
private void OutputPageSummaryData(DataTable source)
{
double totalsl = 0.0f;
foreach (DataRow row in source.Rows)
{
object sl = row["SL"];
if (Convert.IsDBNull(row["SL"]))
{
sl = "0";
}
totalsl += Convert.ToDouble(sl);
}
JObject summary = new JObject();
summary.Add("Name", "页小计");
summary.Add("Major", totalsl.ToString("F2"));
summary.Add("SL", totalsl.ToString("F2"));
//hfGrid1Summary.Text = summary.ToString(Newtonsoft.Json.Formatting.None);
Grid1.SummaryData = summary;
}
作者:
sanshi
时间:
2014-5-10 17:54
请尝试使用 RenderField ,而不是 BoundField
欢迎光临 FineUI 官方论坛 (https://www.fineui.com/BBS/)
Powered by Discuz! X3.4