本文整理汇总了C#中DataTable.DataTableIsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# DataTable.DataTableIsEmpty方法的具体用法?C# DataTable.DataTableIsEmpty怎么用?C# DataTable.DataTableIsEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataTable
的用法示例。
在下文中一共展示了DataTable.DataTableIsEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindSearchGrid
public void BindSearchGrid()
{
objBll = new WarringtonBll.WarringtonBll();
SearchParam objSearchParam = new SearchParam()
{
UserId = Utility.GetSessionValue<string>(Constants._LOGINUSERID),
RequestStatus = txtStatus.Text,
RequestNo = txtRequestNo.Text,
RequestDate = string.IsNullOrEmpty(txtRequestDate.Text) ? DateTime.MinValue :
DateTime.ParseExact(txtRequestDate.Text, "MM/dd/yyyy", null),
CompareOperator=ddlOperator.SelectedValue,
NoOfData=Convert.ToInt32(ddlPageSize.SelectedValue)
};
List<UserRequest> lstRequest = objBll.SearchRequest(objSearchParam);
DataTable dtSearchResult = new DataTable();
dtSearchResult.Columns.Add("Request_No");
dtSearchResult.Columns.Add("Request_ID");
dtSearchResult.Columns.Add("Request_Date");
dtSearchResult.Columns.Add("Request_ChangeDate");
dtSearchResult.Columns.Add("Request_Status");
dtSearchResult.Columns.Add("Request_Address");
dtSearchResult.Columns.Add("Request_ShortDesc");
dtSearchResult.Columns.Add("Request_LongDesc");
foreach (UserRequest objrequest in lstRequest)
{
DataRow drRequest = dtSearchResult.NewRow();
drRequest["Request_No"] = objrequest.RequestNo;
drRequest["Request_ID"] = objrequest.RequestId;
drRequest["Request_Date"] = objrequest.CreateDate.Value.Date.ToShortDateString();
drRequest["Request_ChangeDate"] = objrequest.UpdateDate!=null?objrequest.UpdateDate.Value.Date.ToShortDateString():null;
drRequest["Request_Status"] = objrequest.Status.Trim().Equals("O")?"Open":"Closed";
drRequest["Request_Address"] = objrequest.ProblemLocation;
drRequest["Request_ShortDesc"] = objrequest.ShortDescription;
drRequest["Request_LongDesc"] = objrequest.LongDescription;
dtSearchResult.Rows.Add(drRequest);
}
dtSearchResult.AcceptChanges();
grdRequests.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
if (!dtSearchResult.DataTableIsEmpty())
{
Utility.SetSessionValue(Constants._SEARCHREQUESTDATA, dtSearchResult);
grdRequests.DataSource = dtSearchResult;
grdRequests.DataBind();
}
else
{
grdRequests.Dispose();
grdRequests.DataBind();
}
}