protected void UpdateDB() { string output = "<table>"; System.Data.DataTable tbl = SMSHistoryDataDB.GetDataTable(1); foreach (System.Data.DataRow row in tbl.Rows) { SMSHistoryData smsHistory = SMSHistoryDataDB.LoadAll(row); output += "<tr><td>" + smsHistory.SmsHistoryID + "</td><td>" + smsHistory.Booking.BookingID + "</td><td>" + smsHistory.PhoneNumber + "</td><td>" + smsHistory.Message + "</td><td>" + smsHistory.Cost + "</td><td>" + smsHistory.DatetimeSent.ToString("yyyy-MM-dd HH:mm:ss") + "</td><td>" + "</td><td>" + smsHistory.SmstechMessageID + "</td><td>" + smsHistory.SmstechStatus + "</td><td>" + smsHistory.SmstechDatetime + "</td></tr>"; } output += "</table>"; lblSMSes.Text = output; }
protected void FillGrid() { DataTable dt = SMSHistoryDataDB.GetDataTable(1, false); Session["data_sms_history"] = dt; if (dt.Rows.Count > 0) { if (IsPostBack && Session["sortExpression_sms_history"] != null && Session["sortExpression_sms_history"].ToString().Length > 0) { DataView dataView = new DataView(dt); dataView.Sort = Session["sortExpression_sms_history"].ToString(); GrdSMSHistory.DataSource = dataView; } else { GrdSMSHistory.DataSource = dt; } try { GrdSMSHistory.DataBind(); GrdSMSHistory.PagerSettings.FirstPageText = "1"; GrdSMSHistory.PagerSettings.LastPageText = GrdSMSHistory.PageCount.ToString(); GrdSMSHistory.DataBind(); } catch (Exception ex) { SetErrorMessage(ex.ToString()); } } else { dt.Rows.Add(dt.NewRow()); GrdSMSHistory.DataSource = dt; GrdSMSHistory.DataBind(); int TotalColumns = GrdSMSHistory.Rows[0].Cells.Count; GrdSMSHistory.Rows[0].Cells.Clear(); GrdSMSHistory.Rows[0].Cells.Add(new TableCell()); GrdSMSHistory.Rows[0].Cells[0].ColumnSpan = TotalColumns; GrdSMSHistory.Rows[0].Cells[0].Text = "No Record Found"; } }