Image is not display in repeater in asp.net - c#

In my website i am saving data in xml using html editor. When i add a picture before the content means on the top of the content and save it in xml.Now the problem is this that when i am trying to get result from xml to repeater control then image which is on the top of the content is giving me blank result.
Here is the code which i am using for save data in xml
int date = DateTime.Now.Day;
int month = DateTime.Now.Month;
int year = DateTime.Now.Year;
String File = Server.MapPath("~/Data/BlogContent.xml");
int newid;
XDocument doc = XDocument.Load(File);
XElement root = doc.Root;
string id = root.Elements("post").Last().ToString();
XmlDocument pacXML = new XmlDocument();
pacXML.Load(new StringReader(id));
XmlNode xmlnode1;
xmlnode1 = pacXML.DocumentElement.ChildNodes.Item(1);
String stCode = Convert.ToString(pacXML.DocumentElement.ChildNodes.Item(0).InnerText).Trim();
if (xmlnode1 == null)
{
newid = 1;
}
newid = Convert.ToInt32(stCode.ToString()) + 1;
XmlDocument xdoc = new XmlDocument();
xdoc.Load(File);
XmlNode xnode = xdoc.SelectSingleNode("content");
XmlNode xrnode = xnode.AppendChild(xdoc.CreateNode(XmlNodeType.Element, "post", ""));
xrnode.AppendChild(xdoc.CreateNode(XmlNodeType.Element, "id", "")).InnerText = newid.ToString();
xrnode.AppendChild(xdoc.CreateNode(XmlNodeType.Element, "title", "")).InnerText = TextBox1.Text;
xrnode.AppendChild(xdoc.CreateNode(XmlNodeType.Element, "Discription", "")).InnerText = Editor.Text;
xrnode.AppendChild(xdoc.CreateNode(XmlNodeType.Element, "dt", "")).InnerText = date.ToString();
xrnode.AppendChild(xdoc.CreateNode(XmlNodeType.Element, "mnt", "")).InnerText = month.ToString();
xrnode.AppendChild(xdoc.CreateNode(XmlNodeType.Element, "yr", "")).InnerText = year.ToString();
xrnode.AppendChild(xdoc.CreateNode(XmlNodeType.Element, "PostDate", "")).InnerText = DateTime.Now.ToString("MM/dd/yyyy");
xdoc.Save(File);
Editor.Text = string.Empty;
TextBox1.Text = string.Empty;
and it is the code of display data in repeater
PagedDataSource page = new PagedDataSource();
page.AllowCustomPaging = true;
page.AllowPaging = true;
DataTable dtv = (DataTable)ViewState["Mytable"];
DataView dv = new DataView();
dv = dtv.DefaultView;
dv.Sort = dtv.Columns["id"].ColumnName;
dv.Sort += " Desc";
dv.RowFilter = "id>=" + pageSize + " AND " + "id<=" + take;
page.DataSource = dv;
page.PageSize = psize;
Repeater1.DataSource = page;
Repeater1.DataBind();
if (!IsPostBack)
{
int rowcount = dtv.Rows.Count;
CreatePagingControl(rowcount);
}
here repeater is binding
<asp:Repeater ID="Repeater1" runat="server"
onitemcommand="Repeater1_ItemCommand"
onitemdatabound="Repeater1_ItemDataBound1" >
<ItemTemplate>
<ul class="articles box">
<li>
<asp:Label ID="Label1" runat="server" Text='<%#Eval("id") %>' color="white"></asp:Label>
<h2><a href='<%# Eval("id","PostComment.aspx?id={0}") %>'> <asp:Label ID="Label3" runat="server" Text='<%#Eval("title ") %>'></asp:Label></a></h2>
<div class="article-info box">
<p class="f-right"><asp:Label ID="Label4" runat="server" Text="Label"></asp:Label></p>
<p class="f-left">
Post Date:<asp:Label ID="Label2" runat="server" Text='<%#Eval("postdate") %>'></asp:Label>
</div>
<p> <asp:Label ID="Label5" runat="server" Text="this is the blog of journeycook.com website" Visible="false"></asp:Label>
<asp:Label ID="lblcontent" runat="server" Text='<%# Limit(Eval("Discription"),1000) %>'></asp:Label></p>
<p class="more"><asp:HyperLink ID="ReadMoreLinkButton" runat="server" NavigateUrl='<%# Eval("id","~/PostComment.aspx?id={0}") %>'>Read More</asp:HyperLink></p>
<%-- <asp:LinkButton ID="ReadMoreLinkButton" runat="server"
Text="Read More"
NavigateUrl='<%# Eval("id","~/PostComment.aspx?id={0}") %>'></asp:LinkButton>--%><br /><br /><br />
</li>
</ul>
</ItemTemplate>
</asp:Repeater>
I hope you understand what is my problem

Related

How to transfer this code from ASP.NET to ASP.NET MVC to print crystal reports

I have ASP.NET application and some crystal reports and I need to transfer the following code from ASP.NET and use same functionality in MVC , I am using entity framework.
this is the form.aspx code which i send the parameters value to the other form by using hyperlink and NavigateUrl:
<asp:GridView ID="GridView1" Width="100%" CssClass="dynamicTable table table-striped table-bordered table-condensed" style="color:#000000;background-color:#f4eb3c " AutoGenerateColumns="false" runat="server">
<Columns>
<asp:TemplateField>
<HeaderTemplate>Print</HeaderTemplate>
<ItemTemplate>
<div style="width:100%"> <asp:HyperLink ID="HyperLink1" NavigateUrl='<%#"/RPT/WebForm1.aspx?order_id=" +Eval("order number")+"&DEPT ID=" +Eval("DEPTID")+"&Test Id=" +Eval("Test Id")+"&Culture=" +Eval("Culture")%>' runat="server">Print Result</asp:HyperLink></div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Patient MRN#</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblTest" runat="server" Text='<%# Eval("Patient No") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Order Number</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblTest" runat="server" Text='<%# Eval("order number") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Patient Name</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblTest" runat="server" Text='<%# Eval("Patient Name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>AGE</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblTest" runat="server" Text='<%# Eval("AGE") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Request Date</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblTest" runat="server" Text='<%# Eval("Collection Date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Report Date</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblTest" runat="server" Text='<%# Eval("Report Date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Test Name</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblTest" runat="server" Text='<%# Eval("Test_Name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Result</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblTest" runat="server" Text='<%# Eval("Result") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Ref.Range From</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="Reflow" runat="server" Text='<%# Eval("Low Range") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>To</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="Reflow" runat="server" Text='<%# Eval("High Range") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Text Range</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="Reflow" runat="server" Text='<%# Eval("Text Range") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>REQ. FORM NO.</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="req" runat="server" Text='<%# Eval("REQ FORM NUMBER") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblTest" Visible="false" runat="server" Text='<%# Eval("DEPTID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate></HeaderTemplate>
<ItemTemplate>
<asp:Label ID="LblTest" Visible="false" runat="server" Text='<%# Eval("Culture") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>No Data Found - لم يتم العثور على بيانات</EmptyDataTemplate>
</asp:GridView>
This is the ASP.NET webform.aspx.cs code :
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
TXTORDERID.Text = Request.QueryString["order_number"].ToString();
TXTDEPTID.Text = Request.QueryString["DEPTID"].ToString();
TXTTESTID.Text = Request.QueryString["Test_Id"].ToString();
TXTCULTURE.Text = Request.QueryString["Culture"].ToString();
ReportDocument reportDocument = new ReportDocument();
ParameterFields paramFields = new ParameterFields();
ParameterField paramField = new ParameterField();
ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
ParameterDiscreteValue paramDiscreteValue1 = new ParameterDiscreteValue();
ParameterField parameterField1 = new ParameterField();
ParameterDiscreteValue parameterDiscreteValue1 = new ParameterDiscreteValue();
ParameterFields parameterFields = new ParameterFields();
if (Convert.ToInt32(TXTDEPTID.Text) == 7 && Convert.ToInt32(TXTCULTURE.Text) == 1)
{
TXTPOSITIVE.Text = Request.QueryString["Positive"].ToString();
}
if (Session["UserCustid"] != null && Convert.ToInt32(Session["UserCustid"]) > 0)
{
if (Convert.ToInt32(TXTDEPTID.Text) == 1 || Convert.ToInt32(TXTDEPTID.Text) == 2 || Convert.ToInt32(TXTDEPTID.Text) == 3 || Convert.ToInt32(TXTDEPTID.Text) == 4)
{
paramField.Name = "#ORDER_ID";
paramDiscreteValue.Value = TXTORDERID.Text.ToString();
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
paramField = new ParameterField(); // <-- This line is added
paramDiscreteValue = new ParameterDiscreteValue(); // <-- This line is added
paramField.Name = "#deptid";
paramDiscreteValue1.Value = TXTDEPTID.Text.ToString();
paramField.CurrentValues.Add(paramDiscreteValue1);
paramFields.Add(paramField);
CrystalReportViewer1.ParameterFieldInfo = paramFields;
CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;
CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
reportDocument.Load(Server.MapPath("~/RPT/RPT_RESULTS.rpt"));
CrystalReportViewer1.ReportSource = reportDocument;
reportDocument.SetDatabaseLogon("DBadmin", "1111");
var connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = "DB";
connectionInfo.DatabaseName = "DB";
connectionInfo.Password = "1111";
connectionInfo.UserID = "DBadmin";
connectionInfo.Type = ConnectionInfoType.SQL;
connectionInfo.IntegratedSecurity = false;
for (int i = 0; i < CrystalReportViewer1.LogOnInfo.Count; i++)
{
CrystalReportViewer1.LogOnInfo[i].ConnectionInfo = connectionInfo;
}
}
else if (Convert.ToInt32(TXTDEPTID.Text) == 5)
{
paramField.Name = "#Criteria";
paramDiscreteValue.Value = TXTORDERID.Text.ToString();
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
paramField = new ParameterField(); // <-- This line is added
paramDiscreteValue = new ParameterDiscreteValue(); // <-- This line is added
paramField.Name = "#TESTID";
paramDiscreteValue1.Value = TXTDEPTID.Text.ToString();
paramField.CurrentValues.Add(paramDiscreteValue1);
paramFields.Add(paramField);
CrystalReportViewer1.ParameterFieldInfo = paramFields;
CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;
CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
reportDocument.Load(Server.MapPath("~/RPT/RPT_HISTO_RESULT.rpt"));
CrystalReportViewer1.ReportSource = reportDocument;
reportDocument.SetDatabaseLogon("DBadmin", "1111");
var connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = "DB";
connectionInfo.DatabaseName = "DB";
connectionInfo.Password = "1111";
connectionInfo.UserID = "DBadmin";
connectionInfo.Type = ConnectionInfoType.SQL;
connectionInfo.IntegratedSecurity = false;
for (int i = 0; i < CrystalReportViewer1.LogOnInfo.Count; i++)
{
CrystalReportViewer1.LogOnInfo[i].ConnectionInfo = connectionInfo;
}
}
else if (Convert.ToInt32(TXTDEPTID.Text) == 6 && Convert.ToInt32(TXTTESTID.Text) == 1106)
{
paramField.Name = "#Criteria";
paramDiscreteValue.Value = TXTORDERID.Text.ToString();
paramField.CurrentValues.Add(paramDiscreteValue);
paramFields.Add(paramField);
CrystalReportViewer1.ParameterFieldInfo = paramFields;
CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
reportDocument.Load(Server.MapPath("~/RPT/RPT_SEMEN_RESULT.rpt"));
CrystalReportViewer1.ReportSource = reportDocument;
reportDocument.SetDatabaseLogon("DBadmin", "1111");
var connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = "DB";
connectionInfo.DatabaseName = "DB";
connectionInfo.Password = "1111";
connectionInfo.UserID = "DBadmin";
connectionInfo.Type = ConnectionInfoType.SQL;
connectionInfo.IntegratedSecurity = false;
for (int i = 0; i < CrystalReportViewer1.LogOnInfo.Count; i++)
{
CrystalReportViewer1.LogOnInfo[i].ConnectionInfo = connectionInfo;
}
}
IN ASP.NET MVC :
1- I created a webform.aspx.cs and used same code above in MVC project
2- I created the controller code and view
this is the view code :
<div id="hemadiv">
#if (labhema1 != null && labhema1.Report_Date.HasValue)
{
<img width="700" height="200" src="~/Contents/images/aljawdahlogo.png" />
Print Result
<table class="table table-bordered">
<tr>
<td style="text-align:center">
<input type="submit" value="Heamatology Result " onclick="PrintElemhema('#hemadiv')" class="btn btn-primary" />
</td>
</tr>
</table>
<div>
<dl class="horizontal" style="padding:10px">
<dt style="width: 20%;display: inline-block;color:blue;">#Html.DisplayNameFor(model => model.labCashView.FirstOrDefault().Patient_Name)</dt>
<dd style="width: 25%;display: inline-block;margin: 0px;margin-left:-50px">#Html.DisplayFor(model => model.labCashView.FirstOrDefault().Patient_Name)</dd>
<dt style="width: 22%;display: inline-block;color:blue;">#Html.DisplayNameFor(model => model.labCashView.FirstOrDefault().Customer_Name)</dt>
<dd style="width: 25%;display: inline-block;margin: 0px;margin-left:0px">#Html.DisplayFor(model => model.labCashView.FirstOrDefault().Customer_Name)</dd>
<dt style="width: 20%;display: inline-block;color:blue;">#Html.DisplayNameFor(model => model.labCashView.FirstOrDefault().Patient_No)</dt>
<dd style="width: 25%;display: inline-block;margin: 0px;margin-left:-50px">#Html.DisplayFor(model => model.labCashView.FirstOrDefault().Patient_No)</dd>
<dt style="width: 22%;display: inline-block;margin-left:0px;color:blue;">#Html.DisplayNameFor(model => model.labCashView.FirstOrDefault().Collection_Date)</dt>
<dd style="width: 25%;display: inline-block;margin: 0px;margin-left:0px">#Html.DisplayFor(model => model.labCashView.FirstOrDefault().Collection_Date)</dd>
<dt style="width: 20%;display: inline-block;color:blue;">#Html.DisplayNameFor(model => model.labCashView.FirstOrDefault().SEX)</dt>
<dd style="width: 20%;display: inline-block;margin: 0px;margin-left:-50px">#Html.DisplayFor(model => model.labCashView.FirstOrDefault().SEX)</dd>
<dt style="width: 22%;display: inline-block;margin-left:60px;color:blue;">#Html.DisplayNameFor(model => model.labCashView.FirstOrDefault().Receiving_Date)</dt>
<dd style="width: 25%;display: inline-block;margin: 0px;margin-left:0px">#Html.DisplayFor(model => model.labCashView.FirstOrDefault().Receiving_Date)</dd>
<dt style="width: 20%;display: inline-block;color:blue;">#Html.DisplayNameFor(model => model.labCashView.FirstOrDefault().AGE)</dt>
<dd style="width: 20%;display: inline-block;margin: 0px;margin-left:-50px">#Html.DisplayFor(model => model.labCashView.FirstOrDefault().AGE)</dd>
<dt style="width: 22%;display: inline-block;margin-left:60px;color:blue;">#Html.DisplayNameFor(model => model.labCashView.FirstOrDefault().Report_Date)</dt>
<dd style="width: 25%;display: inline-block;margin: 0px;margin-left:0px">#Html.DisplayFor(model => model.labCashView.FirstOrDefault().Report_Date)</dd>
<dt style="width: 20%;display: inline-block;color:blue;">#Html.DisplayNameFor(model => model.labCashView.FirstOrDefault().order_number)</dt>
<dd style="width: 25%;display: inline-block;margin: 0px;margin-left:-50px">#Html.DisplayFor(model => model.labCashView.FirstOrDefault().order_number)</dd>
</dl>
</div>
<div class="tab-pane container active" id="hemadiv">
#*<h5 class="text-uppercase p-2 text-center">Hematology Department</h5>*#
<table class="table table-bordered" cellpadding="5" cellspacing="5" >
<thead>
<tr>
#*<th>#Html.DisplayNameFor(m => m.labCashView.FirstOrDefault().Patient_No)</th>
<th>#Html.DisplayNameFor(m => m.labCashView.FirstOrDefault().Patient_Name)</th>*#
<th>#Html.DisplayNameFor(m => m.labCashView.FirstOrDefault().Test_Name)</th>
<th>#Html.DisplayNameFor(m => m.labCashView.FirstOrDefault().Result)</th>
<th>#Html.DisplayNameFor(m => m.labCashView.FirstOrDefault().Low_Range)</th>
<th>#Html.DisplayNameFor(m => m.labCashView.FirstOrDefault().High_Range)</th>
<th>#Html.DisplayNameFor(m => m.labCashView.FirstOrDefault().Text_Range)</th>
#*<th>#Html.DisplayNameFor(m => m.labCashView.FirstOrDefault().Report_Date)</th>*#
</tr>
</thead>
#foreach (var employee in Model.labCashView.Where(x => hema.Contains(x.DEPTID.GetValueOrDefault())))
{
<tr>
#*<td>#employee.Patient_No</td>
<td>#employee.Patient_Name</td>*#
<td>#employee.Test_Name</td>
<td>#employee.Result</td>
<td>#employee.Low_Range</td>
<td>#employee.High_Range</td>
<td>#employee.Text_Range</td>
#*<td>#employee.Report_Date</td>*#
</tr>
}
</table>
</div>
}
3- this is the controller code :
public ActionResult CashData(int id)
{
var tables = new Orders_Tables
{
testsRanges = db.TestsRanges.ToList(),
LabResults = db.LAB_RESULTS.Where(o => o.ORDER_ID == id)
.Include(p => p.LabTests)
.Include(t => t.Patients).ToList(),
LabParaResult = db.LAB_PARA_RESULTS.Where(o => o.ORDER_ID == id).Include(t => t.Patients).Include(t => t.LabTests).Include(c => c.Customers).ToList(),
LabCultureResults = db.LAB_CULTURE_RESULT.Where(o => o.ORDER_ID == id).Include(t => t.Patients).Include(t => t.LabTests).Include(c => c.Customers).ToList(),
LabMicroResults = db.LAB_MICRO_NEGATIVE_RESULT.Where(o => o.ORDER_ID == id).ToList(),
labCashView = db.LAB_RESULT_CASH_VIEW.Where(o => o.order_number == id).ToList(),
LabParasitologyView = db.LAB_PARASITOLOGY_VIEW.Where(o => o.order_number == id).ToList(),
LabCulturesView = db.LAB_CULTURES_VIEW.Where(o => o.ORDER_ID == id).ToList(),
LabMicroView = db.LAB_MICRO_VIEW.Where(o => o.ORDER_ID == id).ToList(),
LabHistopathologyView = db.LAB_HISTOPATHOLOGY_VIEW.Where(o => o.ORDER_ID == id).ToList(),
LabHistoResult = db.LAB_HISTO_RESULT.Where(o => o.ORDER_ID == id).ToList(),
labtests = db.LabTests.ToList(),
// patients = db.Patients.ToList()
};
4- i created the class LABCASHVIEW
I checked alot of articles in stackoverflow site and one answer just he wrote you can use same design from ASP.NET in ASP.NET MVC
create webform in your MVC project and pass the parameters from MVC to webform then it will work and print crystal reports as same as ASP.NET .
So I did what he said but now I need the final step , How to pass the following parameters from MVC view to webform and print crystal reports :
I need to send the selected order_number , dept_Id , Test_Id and culture parameters from selected row to webform and print crystal report
I used
<a> tag and href="" to
but how to pass all this parameter one time to webform and avoid the error reference object not set to an instance of an object and check if parameters not null first ?
this is the question and answer but no details how to call crystal reports and how to pass multiple parameters to crystal report , for example if i need to print selected order_id or selected invoice :
https://stackoverflow.com/questions/348785/crystal-reports-in-asp-net-mvc
UPDATE :
I gave static values for these textboxes in webform.aspx.cs
and its printing now :
TXTORDERID.Text = "2000000054";
TXTDEPTID.Text = "1";
TXTTESTID.Text = "46";
TXTCULTURE.Text = "2";
now final issue how to send the value for these text boxes in webform from MVC view as the following :
TXTORDERID.Text = Request.QueryString["labCashView.order_number"].ToString();
TXTDEPTID.Text = Request.QueryString["labCashView.DEPTID"].ToString();
TXTTESTID.Text = Request.QueryString["labCashView.Test_Id"].ToString();
TXTCULTURE.Text = Request.QueryString["labCashView.Culture"].ToString();
As I see you completed everything and you need to pass parameters from View to crystal reports try this solution :
Print Result
Then in webform.aspx.cs write the following code and use the value passed from the link :
TXTORDERID.Text = Request.QueryString["order_number"].ToString();
TXTDEPTID.Text = Request.QueryString["deptid"].ToString();
TXTTESTID.Text = Request.QueryString["testid"].ToString();
TXTCULTURE.Text = Request.QueryString["Culture"].ToString();
Hope this will help you and print crystal reports in your MVC view.

How to initialize data for flagged questions and bind it to repeater in c#?

I am working on an Online Exam System. I have stucked in questions (Flagged) these are the questions which are marked by student to be attempted later. I have table named "Questionsflagged" in db. Let's suppose there is a Now I want to initialize data for first question. Here is the code behind button of reviseflagged.
aspx page
Below is the code for repeater.
<div class="col-sm-6 col-sm-pull-1">
<div class="col-sm-1 checkbox">
<label>
<asp:CheckBox ToolTip="Mark as Flagged" ID="cbFlagged"
runat="server" OnCheckedChanged="cbFlagged_CheckedChanged" />
</label>
</div>
<asp:Repeater ID="repeaterItems" runat="server">
<ItemTemplate>
<div class="form-group">
<div class="row">
<div class="col-sm-offset-2" style="text-align:justify">
<asp:Label CssClass="question" id="lblQuestionNo" runat="server">Question # <%# DataBinder.Eval(Container.DataItem, "SrNo") %></asp:Label>: <asp:Label ID="lblQuestionText" CssClass="question" runat="server"><%# DataBinder.Eval(Container.DataItem, "QuestionText") %></asp:Label>
</div>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
<br />
<div class="col-sm-offset-2">
<asp:RadioButtonList CssClass="spaced" EnableViewState="true" ViewStateMode="Enabled" ID="rblOptions" runat="server" RepeatDirection="Vertical" OnSelectedIndexChanged="rblOptions_SelectedIndexChanged">
<asp:ListItem></asp:ListItem>
<asp:ListItem></asp:ListItem>
<asp:ListItem></asp:ListItem>
<asp:ListItem></asp:ListItem>
</asp:RadioButtonList>
</div>
</div>
Get Flagged
protected void btnReviseFlagged_Click(object sender, EventArgs e)
{
if (getFlaggedQuestions().Rows.Count != 0)
{
//CurrentPageNo = int.Parse(dt.Rows[0]["Id"].ToString());
//IncrementCount = int.Parse(dt.Rows[0]["Id"].ToString());
lblCurrentPage.Visible = true;
//var first record
//NavigateRecords(dtQuestionFlagged);
isFlagged = true;
questionsFlagged = makeFlaggedData();
IncrementCount = int.Parse(questionsFlagged.Rows[0]["SrNo"].ToString());
CurrentPageNo = int.Parse(questionsFlagged.Rows[0]["SrNo"].ToString());
var questionNo = repeaterItems.FindControl("lblQuestionNo") as Label;
questionNo = new Label();
questionNo.Text = questionsFlagged.Rows[0]["SrNo"].ToString();
var questionText = repeaterItems.FindControl("lblQuestionText") as Label;
questionText = new Label();
questionText.Text = questionsFlagged.Rows[0]["QuestionText"].ToString();
//build query for flagged
var flaggedData = from qflagged in questionsFlagged.AsEnumerable()
where qflagged.Field<int>("SrNo") == int.Parse(questionNo.Text)
select new
{
SrNo = qflagged.Field<int>("SrNo"),
QuestionText = qflagged.Field<string>("QuestionText")
};
repeaterItems.DataSource = flaggedData.AsEnumerable();
repeaterItems.DataBind();
Dictionary<string, string> values = new Dictionary<string, string>();
for (int j = 3; j < 7; j++)
{
Below is the line where I got error. I have marked question no. 5 as flagged but at this line compiler shows there is no row at position 5
values.Add(questionsFlagged.Rows[IncrementCount][j].ToString(), questionsFlagged.Columns[j].ToString());
}
//var options = repeaterItemsFindControl("rblOptions") as RadioButtonList;
//options = new RadioButtonList();
rblOptions.DataSource = values;
rblOptions.DataTextField = "Key";
rblOptions.DataValueField = "Value";
rblOptions.DataBind();
lblCurrentPage.Text = CurrentPageNo.ToString();
NavigateRecords(questionsFlagged);
}
else
{
isFlagged = false;
}
}
Normal Navigation on repeater with option to pass flagged questions
public void NavigateRecords(DataTable dtFlaggedParameter)
{
PagedDataSource pds = new PagedDataSource();
//IncrementCount+=1;
//CurrentPageNo+=1;
if (getFlaggedQuestions().Rows.Count != 0)
{
getFlaggedQuestions();
cbFlagged.Checked = false;
}
if (isFlagged == true)
{
if (dtFlaggedParameter.Rows.Count > 0)
{
pds.DataSource = dtFlaggedParameter.DefaultView;
pds.AllowPaging = true;
pds.PageSize = 1;
// Set the PagedDataSource's current page
pds.CurrentPageIndex = CurrentPageNo;
lblCurrentPage.Text = "Page No: " + (CurrentPageNo + 1).ToString() + " of "
+ pds.PageCount.ToString();
btnPrev.Enabled = !pds.IsFirstPage;
//btnNext.Enabled = !pds.IsLastPage;
btnFirst.Enabled = !pds.IsFirstPage;
btnLast.Enabled = !pds.IsLastPage;
//btnSubmit.Visible = pds.IsLastPage;
repeaterItems.DataSource = pds;
repeaterItems.DataBind();
Dictionary<string, string> values = new Dictionary<string, string>();
for (int j = 3; j < 7; j++)
{
values.Add(dtFlaggedParameter.Rows[IncrementCount]
[j].ToString(), dtFlaggedParameter.Columns[j].ToString());
}
//var options = repeaterItemsFindControl("rblOptions") as
RadioButtonList;
//options = new RadioButtonList();
rblOptions.DataSource = values;
rblOptions.DataTextField = "Key";
rblOptions.DataValueField = "Value";
rblOptions.DataBind();
}
}
else{
//same code as above but that datatable's name is dt
}

ASP button not posting back after exporting a pdf from ashx using response.write

I am exporting a pdf from a json string from database. My export buttons are in a gridview control - Image buttons. I am using a Handler (ashx) file for exporting.
The problem is, after exporting the buttons on the page (one button and one command field) are not posting back. My handler code and aspx code are below
Handler
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.html;
using iTextSharp.text.html.simpleparser;
using System.IO;
using System.Web.UI;
using System.Data;
using GE.MSA.DataQuality.DataAccess;
using GE.MSA.DataQuality.DataAccess.Authentication;
using GE.MSA.DataQuality.DataAccess.EntityModel;
using Newtonsoft.Json;
namespace GE.MSA.DataQuality.Web
{
/// <summary>
/// Summary description for CreatePDF
/// </summary>
public class CreatePDF : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
//context.Response.ContentType = "text/plain";
//context.Response.Write("Hello World");
int _id = Convert.ToInt32(context.Request.QueryString["Id"]);
string _report = context.Request.QueryString["Report"];
string _lockedfrom = context.Request.QueryString["LockedFrom"];
string _lockedto = context.Request.QueryString["LockedTo"];
string _docheader = (_report == "CostServiceReport" ? "Cost & Service Report - " : "Service Report - ") + "Locked from : " + _lockedfrom + " to " + _lockedto;
string _doctitle = _report + "-" + _lockedfrom + "-" + _lockedto + ".pdf";
DataTable _PDFReport = new DataTable();
if (_report == "CostServiceReport")
{
using (var db = new dbReferenceTablesEntities())
{
string csr = (from i in db.CS_Billing_LockPeriod
where i.ID == _id
select i.CostServiceReport).FirstOrDefault().ToString();
_PDFReport = (DataTable)JsonConvert.DeserializeObject(csr, _PDFReport.GetType());
}
}
else
{
if (_report == "ServiceReport")
{
using (var db = new dbReferenceTablesEntities())
{
string sr = (from i in db.CS_Billing_LockPeriod
where i.ID == _id
select i.ServiceReport).FirstOrDefault().ToString();
_PDFReport = (DataTable)JsonConvert.DeserializeObject(sr, _PDFReport.GetType());
}
}
}
Document pdfDoc = new Document(PageSize.A3, 20, 20, 20, 20);
pdfDoc.SetPageSize(iTextSharp.text.PageSize.A3.Rotate());
try
{
PdfWriter.GetInstance(pdfDoc, System.Web.HttpContext.Current.Response.OutputStream);
pdfDoc.Open();
Chunk c = new Chunk("" + _docheader + "", FontFactory.GetFont("Verdana", 15));
Paragraph p = new Paragraph();
p.Alignment = Element.ALIGN_CENTER;
p.Add(c);
pdfDoc.Add(p);
string clientLogo = context.Server.MapPath(".") + "/images/abc.png";
string imageFilePath = context.Server.MapPath(".") + "/images/abc.png";
iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(imageFilePath);
//Resize image depend upon your need
jpg.ScaleToFit(60f, 40f);
//Give space before image
jpg.SpacingBefore = 0f;
//Give some space after the image
jpg.SpacingAfter = 1f;
jpg.Alignment = Element.HEADER;
pdfDoc.Add(jpg);
Font font8 = FontFactory.GetFont("ARIAL", 7);
DataTable dt = _PDFReport;
if (dt != null & dt.Rows.Count > 0)
{
//Craete instance of the pdf table and set the number of column in that table
PdfPTable PdfTable = new PdfPTable(dt.Columns.Count);
PdfTable.HeaderRows = 1;
PdfPCell PdfPCell = null;
for (int i = 0; i < dt.Columns.Count; i++)
{
PdfPCell = new PdfPCell(new Phrase(new Chunk(dt.Columns[i].ColumnName.ToString(), FontFactory.GetFont("Verdana", 12))));
PdfPCell.HorizontalAlignment = Element.ALIGN_CENTER;
PdfPCell.VerticalAlignment = Element.ALIGN_MIDDLE;
PdfPCell.BackgroundColor = new Color(109, 159, 213);
PdfTable.AddCell(PdfPCell);
}
for (int rows = 0; rows < dt.Rows.Count; rows++)
{
for (int column = 0; column < dt.Columns.Count; column++)
{
PdfPCell = new PdfPCell(new Phrase(new Chunk(dt.Rows[rows][column].ToString(), font8)));
PdfTable.AddCell(PdfPCell);
}
}
//PdfTable.SpacingBefore = 15f; // Give some space after the text or it may overlap the table
pdfDoc.Add(PdfTable); // add pdf table to the document
}
pdfDoc.Close();
context.Response.ContentType = "application/pdf";
context.Response.AddHeader("content-disposition", "attachment; filename= " + _doctitle);
System.Web.HttpContext.Current.Response.Write(pdfDoc);
context.Response.Flush();
HttpContext.Current.ApplicationInstance.CompleteRequest();
}
catch (DocumentException de)
{
System.Web.HttpContext.Current.Response.Write(de.Message);
}
catch (IOException ioEx)
{
System.Web.HttpContext.Current.Response.Write(ioEx.Message);
}
catch (Exception ex)
{
System.Web.HttpContext.Current.Response.Write(ex.Message);
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}
ASPX Page
<%# Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="LockForcing.aspx.cs" Inherits="GE.MSA.DataQuality.Web.LockForcing" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:ScriptManager ID="scriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="up1" runat="server">
<ContentTemplate>
<h2>Lock Force Calculation</h2>
<div>
<fieldset>
<legend>Set Lock Period</legend>
<table>
<tr>
<td>
<label>Start Month</label></td>
<td>
<asp:DropDownList ID="ddlStartMonth" runat="server" Width="100%">
<asp:ListItem>01</asp:ListItem>
<asp:ListItem>02</asp:ListItem>
<asp:ListItem>03</asp:ListItem>
<asp:ListItem>04</asp:ListItem>
<asp:ListItem>05</asp:ListItem>
<asp:ListItem>06</asp:ListItem>
<asp:ListItem>07</asp:ListItem>
<asp:ListItem>08</asp:ListItem>
<asp:ListItem>09</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>11</asp:ListItem>
<asp:ListItem>12</asp:ListItem>
</asp:DropDownList></li></td>
<td></td>
<td>
<label>Start Year</label></td>
<td>
<asp:DropDownList ID="ddlStartYear" runat="server" Width="100%">
</asp:DropDownList></td>
</tr>
<tr>
<td>
<label>End Month</label></td>
<td>
<asp:DropDownList ID="ddlEndMonth" runat="server" Width="100%">
<asp:ListItem>01</asp:ListItem>
<asp:ListItem>02</asp:ListItem>
<asp:ListItem>03</asp:ListItem>
<asp:ListItem>04</asp:ListItem>
<asp:ListItem>05</asp:ListItem>
<asp:ListItem>06</asp:ListItem>
<asp:ListItem>07</asp:ListItem>
<asp:ListItem>08</asp:ListItem>
<asp:ListItem>09</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>11</asp:ListItem>
<asp:ListItem>12</asp:ListItem>
</asp:DropDownList></td>
<td></td>
<td>
<label>End Year</label></td>
<td>
<asp:DropDownList ID="ddlEndYear" runat="server" Width="100%">
</asp:DropDownList></td>
<td>
<asp:Button ID="btnLock" runat="server" Width="120px" Text="Lock" CssClass="submitButton"
BorderStyle="None" OnClick="btnLock_Click" />
</td>
<td>
<asp:Label runat="server" ID="lblLockMessage"></asp:Label>
<asp:Timer ID="Timer1" runat="server" Interval="5000" Enabled="false" OnTick="Timer1_Tick"></asp:Timer>
</td>
</tr>
</table>
</fieldset>
</div>
<div>
<table width="100%">
<tr>
<td>
<label>Lock Period Details</label>
</td>
<td align="right">
<asp:Label runat="server" ID="lblmsg"></asp:Label>
</td>
</tr>
<tr>
<td colspan="2">
<asp:GridView ID="gvLockPeriod" runat="server" AutoGenerateColumns="false" CssClass="mGrid" OnRowDeleting="gvLockPeriod_RowDeleting"
DataKeyNames="Id">
<Columns>
<asp:CommandField ShowDeleteButton="true" ControlStyle-ForeColor="darkcyan" DeleteText="Unlock"></asp:CommandField>
<asp:BoundField DataField="FromDate" HeaderText="FromDate" />
<asp:BoundField DataField="ToDate" HeaderText="ToDate" />
<asp:TemplateField HeaderText="Cost&ServiceReport">
<ItemTemplate>
<asp:ImageButton ImageUrl="~/images/Pdf-16.png" runat="server" ToolTip="Download Cost & Service Report"
Visible='<%# Convert.ToBoolean(Eval("CostServiceReport")) %>'
PostBackUrl='<%#"CreatePDF.ashx?id="+Eval("Id")+"&Report=CostServiceReport"+"&LockedFrom="+Eval("fromdate")+"&LockedTo="+Eval("todate")+""%>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="ServiceReport">
<ItemTemplate>
<asp:ImageButton ImageUrl="~/images/Pdf-16.png" runat="server" ToolTip="Download Service Report"
Visible='<%# Convert.ToBoolean(Eval("ServiceReport")) %>'
PostBackUrl='<%#"CreatePDF.ashx?id="+Eval("Id")+"&Report=ServiceReport"+"&LockedFrom="+Eval("fromdate")+"&LockedTo="+Eval("todate")+""%>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ModifiedBy" HeaderText="CreatedUser" />
<asp:BoundField DataField="ModifiedDate" HeaderText="CreatedDate" />
</Columns>
</asp:GridView>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<div class="overlays" />
<div style="font-weight: bold; align-content: center" class="overlayContents">
<asp:Image ID="aspImg1" runat="server" ImageUrl="~/images/ajax-loader.GIF" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</asp:Content>
After flushing the response call the response end method.
context.Response.Flush();
System.Web.HttpContext.Current.Response.End();

Sitecore Feed latest 2 items

I have a sitecore web part that I am trying to get to display the top 2 most current items by date. I am having trouble because I am only able to get the latest item to show.
For the ascx Code:
<asp:Repeater ID="newsContainer" runat="server">
<ItemTemplate>
<div class="newsItem">
<h2>News</h2>
<a href="<%# SitecoreUtility.NavigateUrl((Item)Container.DataItem)%>" class="newsHeadline">
<span> <sc:Date ID="Date1" Item="<%# Container.DataItem %>" Field="Posted-Date" Format="MM.dd.yyyy" runat="server" />
<sc:Text ID="Text1" Item="<%# Container.DataItem %>" Field="Title" runat="server" />
</span>
</a>
<!-- <p class="newsSummary">
<asp:Literal ID="litBody" runat="server" Text="<%# SitecoreUtility.TruncateByWords(((Item)Container.DataItem).Fields[Constants.Fields.BODY].Value, 20) %>"></asp:Literal>
...
+ More</p> -->
</div>
</ItemTemplate>
</asp:Repeater>
<asp:Panel ID="pnlPagination" runat="server"></asp:Panel>
<asp:Panel ID="pnlArchive" runat="server">
<!-- <div class="newsArchiveLink">
View Archived News
</div> -->
</asp:Panel>
<asp:Panel ID="pnlCurrent" runat="server">
<div class="newsArchiveLink">
View Current News
</div>
</asp:Panel>
For the ASCX.CS File:
public partial class Homepage_NewsListing : BaseSublayout
{
int CurrentPage = 1;
int PageSize = Constants.Values.SEARCH_SMALL_LIST;
protected void Page_Load(object sender, EventArgs e)
{
CurrentPage = int.Parse(WebUtil.GetQueryString("page", "1"));
List<Item> newsListings = new List<Item>();
Item newsItems = SitecoreUtility.Db.GetItem(Constants.Items.NEWS);
if (WebUtil.GetQueryString("type", "") == "archive")
{
newsListings = newsItems.Children.Where(item =>
(SitecoreUtility.FormatDateAtMidnight(item, Constants.Fields.ARCHIVEDATE) <= DateTime.Now)
&&
(!string.IsNullOrEmpty(item.Fields[Constants.Fields.ARCHIVEDATE].Value))
).OrderBy(item => item.Fields[Constants.Fields.POSTED_DATE].Value).ToList();
pnlArchive.Visible = false;
//pnlCurrent.Visible = true;
pnlCurrent.Visible = false;
}
else
{
newsListings = newsItems.Children.Where(item =>
(SitecoreUtility.FormatDateAtMidnight(item, Constants.Fields.ARCHIVEDATE) > DateTime.Now)
||
(string.IsNullOrEmpty(item.Fields[Constants.Fields.ARCHIVEDATE].Value))
).OrderBy(item => item.Fields[Constants.Fields.POSTED_DATE].Value).ToList();
//pnlArchive.Visible = true;
pnlArchive.Visible = false;
pnlCurrent.Visible = false;
}
newsContainer.DataSource = DisplayResults(newsListings.OrderByDescending(item => item.Fields[Constants.Fields.POSTED_DATE].Value).ToList());
newsContainer.DataBind();
}
protected List<Item> DisplayResults(List<Item> results)
{
pnlPagination.Controls.Add(new Pager(results.Count, PageSize, CurrentPage).BuildPaging());
if (CurrentPage > 1)
return results.Skip((CurrentPage - 1) * PageSize).Take(PageSize).ToList();
return results.Take(PageSize).ToList();
}
}
I would first try to make your code a bit more simple (for debugging) and use a fast query to pull items within a date range.
var date = DateTime.Now.AddMonths(3);
var dateString = date.Year.ToString() + date.Month.ToString().PadLeft(2, '0') + date.Day.ToString().PadLeft(2, '0');
var newsList = Sitecore.Context.Database.SelectItems("fast:/sitecore/content/home/your-path-to-news/*[##templatename='Your template name' and #POSTED_DATE > '" + dateString + "']").ToList();
newsList = newsList.OrderByDescending(n => n.Fields["POSTED_DATE"].Value).Take(2).ToList();
newsContainer.DataSource = newsList;
newsContainer.DataBind();

iTextSharp output to PDF

I've been trying to get this working for a long time now and I was hoping that someone could help me out with this. I am trying to save two ListViews from my ASCX control (incorporated to my ASPX page as follows) to a PDF file. I believe that the problem lies in these two lines of code, as I am getting an 'the document has no pages' error when saving. Any ideas would be greatly appreciated! Thanks in advance...
ListView lv1 = (ListView)TagCloudControl1.FindControl("ListView1");
ListView lv2 = (ListView)TagCloudControl1.FindControl("ListView2");
ASPX page:
<%# Register Src="~/tagcloud.ascx" TagName="TagCloudControl" TagPrefix="TagCloud" %>
...
<TagCloud:TagCloudControl ID="TagCloudControl1" runat="server" />
C#:
private void GeneratePDF(string path, string fileName, bool download, string text) {
var document = new Document();
try{
if (download) {
PdfWriter.GetInstance(document, Response.OutputStream);
} else {
PdfWriter.GetInstance(document, new FileStream(path + fileName, FileMode.Create));
}
StringBuilder strB = new StringBuilder();
document.Open();
if (text.Length.Equals(0)) {
TagCloudControl1.BindTagCloud();
using (StringWriter sWriter = new StringWriter(strB)) {
using (HtmlTextWriter htWriter = new HtmlTextWriter(sWriter)) {
//var lv1 = (TagCloudControl)ListView.FindControl("ListView1");
//var lv2 = (TagCloudControl)ListView.FindControl("ListView2");
ListView lv1 = (ListView)TagCloudControl1.FindControl("ListView1");
ListView lv2 = (ListView)TagCloudControl1.FindControl("ListView2");
lv1.RenderControl(htWriter);
lv2.RenderControl(htWriter);
}
}
} else {
strB.Append(text);
}
using (TextReader sReader = new StringReader(strB.ToString())) {
List<IElement> list = HTMLWorker.ParseToList(sReader, new StyleSheet());
foreach (IElement elm in list) {
document.Add(elm);
}
}
} catch (Exception ee) {
ee.ToString();
} finally {
document.Close();
}
}
protected void GeneratePDFAndDownload (object sender, EventArgs e) {
string fileName = "RetroCloud_" + proj_name + "_" + DateTime.Now.Ticks + ".pdf";
GeneratePDF("", fileName, true, "");
Response.Clear();
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment; filename=" + fileName);
Response.Flush();
Response.End();
}
ASCX Control:
<%# Control Language="C#" AutoEventWireup="true" CodeFile="tagcloud.ascx.cs" Inherits="tagcloud" %>
<div style="padding-left: 25px; padding-right: 25px; text-align: center;">
<asp:listview runat="server" ID="ListView1" ItemPlaceholderID="itemPlaceHolder">
<LayoutTemplate>
<asp:PlaceHolder runat="server" ID="itemPlaceHolder"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<%# Eval("Tag") %>
</ItemTemplate>
<EmptyDataTemplate>
<asp:Label ID="negative_tags" runat="server" style="color: #ff0000;" Text="[NO NEGATIVE TAGS FOUND]"></asp:Label>
</EmptyDataTemplate>
</asp:listview>
</div>
<br />
<div style="padding-left: 25px; padding-right: 25px; text-align: center;">
<asp:listview runat="server" ID="ListView2" ItemPlaceholderID="itemPlaceHolder">
<LayoutTemplate>
<asp:PlaceHolder runat="server" ID="itemPlaceHolder"></asp:PlaceHolder>
</LayoutTemplate>
<ItemTemplate>
<%# Eval("Tag") %>
</ItemTemplate>
<EmptyDataTemplate>
<asp:Label ID="positive_tags" runat="server" style="color: #33cc00;" Text="[NO POSITIVE TAGS FOUND]"></asp:Label>
</EmptyDataTemplate>
</asp:listview>
</div>
ASCX CS FILE:
string proj_id, proj_name, iteration;
protected void Page_Load(object sender, EventArgs e)
{
proj_name = Request.QueryString["project"].ToString();
proj_id = Request.QueryString["id"].ToString();
if (String.IsNullOrEmpty((string)Session["iteration"]))
iteration = "0";
else
iteration = (string)Session["iteration"];
BindTagCloud();
}
private void BindTagCloud()
{
int pro_id = Convert.ToInt32(proj_id);
int iteration_id = Convert.ToInt32(iteration);
....
if (iteration_id != 0)
{
ListView1.DataSource = tagCloudNegativeIteration;
ListView1.DataBind();
ListView2.DataSource = tagCloudPositiveIteration;
ListView2.DataBind();
}
else
{
ListView1.DataSource = tagCloudNegative;
ListView1.DataBind();
ListView2.DataSource = tagCloudPositive;
ListView2.DataBind();
}
"The Document has no pages" means you haven't actually written anything to the Document before calling document.close().
I suspect that if you set a breakpoint at the line where you call document.add(), you'll never hit it.
I suggest you take a long, hard look at the input and output to HTMLWorker.ParseToList(). I doubt it's what you expect.

Categories

Resources