Last post Dec 02, 2016 07:32 PM by PatriceSc
None
0 Points
2 Posts
Dec 02, 2016 05:20 PM|nav1234|LINK
Hi
I am adding PDF file , my file is saved according to path that i gave . but link is not displaying on web page from where i can open and view file
I have two pages from one page where i am adding , other page i am displaying links.
I don't know what i am missing.
Can please somebody help me
Contributor
4611 Points
1706 Posts
Dec 02, 2016 05:51 PM|KathyW|LINK
Your question is not clear. If a link does not display on the page, it wasn't in the page.
I cannot tell from your post what you are doing. Please post your code and explain more fully what you are trying to do and what isn't working.
Dec 02, 2016 06:36 PM|nav1234|LINK
So here is one page whee users can see policies
<div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordionid" href="#link12"> <h5> Policies</h5> </a> </div>
<div id="link12" class="collapse"> <div class="accordion-inner" style="padding-left: 10px;"> <p> <asp:Panel ID="PoliciesPanel" runat="server"> </asp:Panel> </p> </div> </div> </div>
Code behind Policy Page
protected void Page_Load(object sender, EventArgs e) { FormsCodeHandler requestDirector = new FormsCodeHandler(); List<ResourceDetail> Policies = new List<ResourceDetail>();
Policies = requestDirector.FindResourcesByCategory(" Policy");
if (Policies.Count >0) { for (int i = 0; i < Policies.Count; i++) { LinkButton btn = new LinkButton(); btn.Text = Policies[i].Title; string ID = "Policies_" + (i + 1).ToString(); btn.ID = ID; btn.Attributes.Add("runat", "server"); btn.Attributes.Add("onclick", "window.document.forms[0].target='_blank';"); btn.Click += Dynamic_Click; btn.CommandName = Policies[i].Path; btn.CommandArgument = Policies[i].ResourceID.ToString();
Literal lit = new Literal(); lit.Text = "<br />";
PoliciesPanel.Controls.Add(btn); PoliciesPanel.Controls.Add(lit); } }
On the other page managment can add or edit the policies
<asp:DropDownList ID="FileCategory" runat="server" CssClass="RequiredField form-control"> <asp:ListItem Text="Select a Category" Value="0"></asp:ListItem> asp:ListItem Text="Policies" Value="Policies"></asp:ListItem> </asp:DropDownList></label>
<div class="form-group"> <asp:Label ID="Label1" runat="server" Text="Choose a PDF file: "></asp:Label><span class="requiredField"> *</span> <asp:FileUpload ID="ResourceUpload" runat="server" /> </div>
<div class="form-group"> <asp:Button ID="Submit" runat="server" Text="Upload" CssClass="btn btn-success" OnClick="Submit_Click" /> </div> </asp:Panel>
When i add new policy from resources page , it is successfully added , it saves in my folder Policies.
I can see policies header on Policies page, but the files i am adding through Resource Page can't see on Policy Page under Policy List
Hope you understand
Dec 02, 2016 07:22 PM|KathyW|LINK
Is "(Policies.Count >0)"? What have you done to debug this? What part of the code isn't working as you expect?
All-Star
43240 Points
14960 Posts
Dec 02, 2016 07:32 PM|PatriceSc|LINK
Hi,
As reported earlier a basic step is to see which value is found in Policies.Count.
I noticed an extra blank in FindResourcesByCategory(" Policy"); - before the word policy. Could it be that because of that you don't get any policy at all ?
If needed see https://msdn.microsoft.com/en-us/library/mt243867.aspx. A basic step is to check that the line of code that produces the result you want actually runs.
None
0 Points
2 Posts
PDF file link is not showing on web Page
Dec 02, 2016 05:20 PM|nav1234|LINK
Hi
I am adding PDF file , my file is saved according to path that i gave . but link is not displaying on web page from where i can open and view file
I have two pages from one page where i am adding , other page i am displaying links.
I don't know what i am missing.
Can please somebody help me
Contributor
4611 Points
1706 Posts
Re: PDF file link is not showing on web Page
Dec 02, 2016 05:51 PM|KathyW|LINK
Your question is not clear. If a link does not display on the page, it wasn't in the page.
I cannot tell from your post what you are doing. Please post your code and explain more fully what you are trying to do and what isn't working.
None
0 Points
2 Posts
Re: PDF file link is not showing on web Page
Dec 02, 2016 06:36 PM|nav1234|LINK
So here is one page whee users can see policies
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordionid" href="#link12">
<h5> Policies</h5>
</a>
</div>
<div id="link12" class="collapse">
<div class="accordion-inner" style="padding-left: 10px;">
<p>
<asp:Panel ID="PoliciesPanel" runat="server">
</asp:Panel>
</p>
</div>
</div>
</div>
Code behind Policy Page
protected void Page_Load(object sender, EventArgs e)
{
FormsCodeHandler requestDirector = new FormsCodeHandler();
List<ResourceDetail> Policies = new List<ResourceDetail>();
Policies = requestDirector.FindResourcesByCategory(" Policy");
if (Policies.Count >0)
{
for (int i = 0; i < Policies.Count; i++)
{
LinkButton btn = new LinkButton();
btn.Text = Policies[i].Title;
string ID = "Policies_" + (i + 1).ToString();
btn.ID = ID;
btn.Attributes.Add("runat", "server");
btn.Attributes.Add("onclick", "window.document.forms[0].target='_blank';");
btn.Click += Dynamic_Click;
btn.CommandName = Policies[i].Path;
btn.CommandArgument = Policies[i].ResourceID.ToString();
Literal lit = new Literal();
lit.Text = "<br />";
PoliciesPanel.Controls.Add(btn);
PoliciesPanel.Controls.Add(lit);
}
}
On the other page managment can add or edit the policies
<asp:DropDownList ID="FileCategory" runat="server" CssClass="RequiredField form-control">
<asp:ListItem Text="Select a Category" Value="0"></asp:ListItem>
asp:ListItem Text="Policies" Value="Policies"></asp:ListItem>
</asp:DropDownList></label>
<div class="form-group">
<asp:Label ID="Label1" runat="server" Text="Choose a PDF file: "></asp:Label><span class="requiredField"> *</span>
<asp:FileUpload ID="ResourceUpload" runat="server" />
</div>
<div class="form-group">
<asp:Button ID="Submit" runat="server" Text="Upload" CssClass="btn btn-success" OnClick="Submit_Click" />
</div>
</asp:Panel>
When i add new policy from resources page , it is successfully added , it saves in my folder Policies.
I can see policies header on Policies page, but the files i am adding through Resource Page can't see on Policy Page under Policy List
Hope you understand
Contributor
4611 Points
1706 Posts
Re: PDF file link is not showing on web Page
Dec 02, 2016 07:22 PM|KathyW|LINK
Is "(Policies.Count >0)"? What have you done to debug this? What part of the code isn't working as you expect?
All-Star
43240 Points
14960 Posts
Re: PDF file link is not showing on web Page
Dec 02, 2016 07:32 PM|PatriceSc|LINK
Hi,
As reported earlier a basic step is to see which value is found in Policies.Count.
I noticed an extra blank in FindResourcesByCategory(" Policy"); - before the word policy. Could it be that because of that you don't get any policy at all ?
If needed see https://msdn.microsoft.com/en-us/library/mt243867.aspx. A basic step is to check that the line of code that produces the result you want actually runs.