我可以创建asp:PostBackTrigger吗?因为这是我的要求。附加信息。我使用syncfusion(ej1不是ej2)网格。这里我只有div块(multigrid)。所有元素都是动态创建的。因为这是我们的要求。我们通过Example1.json创建datatable。
我的aspx代码:
<form id="form1" runat="server">
<asp:ScriptManager ID="scritPANEID" runat="server"></asp:ScriptManager>
<div>
<asp:UpdatePanel runat="server" ID="multigridupdate" UpdateMode="Conditional">
<ContentTemplate>
<div runat="server" id="multigrid">
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
字符串
我后面的代码是:
public static String root_path = AppDomain.CurrentDomain.BaseDirectory;
public static String rootUrl = "http://localhost:52733/";
public static DataTable dataTable = new DataTable();
public static string linkColName = "PARTY_ID";
Grid Data_Grids = new Grid();
protected void Page_Load(object sender, EventArgs e)
{
string dt = File.ReadAllText(root_path + @"DataSet\Example1.json");
DataTable datatab = UseNewtonsoftJson(dt);
BindDataSource();
}
public static DataTable UseNewtonsoftJson(string sampleJson)
{
if (string.IsNullOrWhiteSpace(sampleJson))
{
return dataTable;
}
dataTable = JsonConvert.DeserializeObject<DataTable>(sampleJson);
return dataTable;
}
public void BindDataSource()
{
Data_Grids.ID = "GridSample";
Data_Grids.EditSettings.AllowEditing = true;
Data_Grids.EditSettings.EditMode = Syncfusion.JavaScript.EditMode.Batch;
Data_Grids.ToolbarSettings.ShowToolbar = true;
Data_Grids.ToolbarSettings.ToolbarItems = new List<string> { "update", "cancel", "excelExport", "pdfExport" };
Data_Grids.DataSource = dataTable;
Data_Grids.ServerPdfExporting += FlatGrid_ServerPdfExporting;
Data_Grids.ServerExcelExporting += FlatGrid_ServerExcelExporting;
Data_Grids.DataBind();
multigrid.Controls.Add(Data_Grids);
multigridupdate.Update();
}
型
这里我想动态地创建触发器,因为
1条答案
按热度按时间im9ewurl1#
您可以通过使用RegisterAsyncPostBackControl方法来实现这一点。
参考下面的代码示例,
字符串
参考以下示例https://www.syncfusion.com/downloads/support/directtrac/general/ze/webform1235591424
请参阅下面的链接,https://learn.microsoft.com/en-us/dotnet/api/system.web.ui.scriptmanager.registerasyncpostbackcontrol?view=netframework-4.8.1