|
where is the html?
modified 20-Sep-20 21:01pm.
|
|
|
|
|
Can someone please help me understand why images is not displaying on this page?
I have a calendar that displays various events with appropriate pictures.
On the calendar itself, a small image is displayed (this works fine).
Here is the code for that:
<body>
<form id="Form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<dc:DataCalendar id="cal1" runat="server"
DayField="EventDate" OnVisibleMonthChanged="MonthChange"
Height="295px" Width="275px" BorderColor="#EFEFDE"
DayNameFormat="Shortest" SelectedDate="2012-11-17">
<DayStyle HorizontalAlign="Left" VerticalAlign="Top"
Font-Size="7" Font-Names="Arial" BackColor="white" />
<OtherMonthDayStyle BackColor="white" ForeColor="white" />
<ItemTemplate>
<a href='#' OnClick="javascript:window.open('admin/eventDetails.aspx?id=<%# Container.DataItem("EventID") %>','EventsDetail','width=800,height=600;toolbar=no;');" & ">
<img alt="" src='images/<%# Container.DataItem("CategoryImage") %>' height="12" width="12" align="absmiddle" border="0" /><br />
<font color='<%# Container.DataItem("CategoryColor") %>'>
<%# Container.DataItem("EventTitle") %>
</font>
</a>
</ItemTemplate>
<TitleStyle BackColor="#CEDFCE" Font-Bold="True" />
</dc:DataCalendar>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
en you on any given date, you are taken to the details page of that part event.
This is where a larger image is supposed to be displayed.
However, the image is not displaying. It is not even showing the little icon when picture is not present.
What am I doing wrong?
Here is that code for the eventDetails page.
Thanks in advance for your assistance.
//VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not IsPostBack Then
If (Not (Request.QueryString("id")) Is Nothing) Then
Session("apomember") = Request.QueryString("id")
End If
BindGrid()
End If
End Sub
Private Sub BindGrid()
Dim myConnectionstring As String = ConfigurationManager.ConnectionStrings("test").ConnectionString
Dim myConn As New SqlConnection(myConnectionstring)
myConn.Open()
Dim cmd As New SqlCommand("SELECT e.EventID, e.EventTitle, e.EventDescription, e.EventDate, c.CategoryTitle, c.CategoryImage, c.CategoryColor " &
"FROM Events e INNER JOIN Categories c ON e.EventCategory = c.CategoryID where c.CategoryID = @apoid ORDER BY e.EventDate", myConn)
cmd.Parameters.AddWithValue("@apoid", Session("apomember"))
Dim dr As SqlDataReader = cmd.ExecuteReader()
If dr.Read() Then
txtTitle.Text = dr("EventTitle").ToString()
txtTitle.Text = dr("EventDate").ToString()
txtDate.Text = dr("EventDescription").ToString()
txtDescription.Text = dr("EventTitle").ToString()
txtCategory.Text = dr("CategoryImage").ToString()
End If
myConn.Close()
End Sub
//Markup
<form id="form1" runat="server">
<div>
<a href="#" id="logo"><img src="/images/skin1/owerri_logo.jpg" Height="245" Width="322"alt="Owerri Family Union" border="0" title="Owerri Family Union" /></a> Owerri Family Union, Atlanta, GA - USA
</div>
<hr />
<table>
<tr style="margin-top:10px;">
<td>Event Title:</td>
<td><asp:Label id="txtTitle" runat="server"></asp:Label></td>
</tr>
<tr style="margin-top:10px;">
<td>Event Date:</td>
<td><asp:Label id="txtDate" runat="server"></asp:Label></td>
</tr>
<tr style="margin-top:10px;">
<td>Event Description:</td>
<td><asp:Label id="txtDescription" runat="server"></asp:Label></td>
</tr>
<tr style="margin-top:10px;">
<td>Category:</td>
<td>
<asp:Image ID="Image1" ImageUrl='/admin/memberPhotos/ & <%# Eval("CategoryImage") %>' runat="server" Height="100" Width="100" />
<asp:Label id="txtCategory" runat="server"></asp:Label></td>
</tr>
</table>
</form>
modified 3-Apr-19 15:56pm.
|
|
|
|
|
samflex wrote:
<asp:Image ID="Image1" ImageUrl='/admin/memberPhotos/ & <%# Eval("CategoryImage") %>' runat="server" Height="100" Width="100" />
You can't mix static and data-bound content in a server property like that. Try:
<asp:Image ID="Image1" ImageUrl='<%# Eval("CategoryImage", "/admin/memberPhotos/{0}") %>' runat="server" Height="100" Width="100" />
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Richard,
That didn't work. It still displays blank image but this *seems* to have worked:
age1.ImageUrl = "~/images/" & dr("CategoryImage").ToString()
Thanks for your help as always sir.
|
|
|
|
|
The one that didn't work is pointing to: /admin/memberPhotos/{image}
The one that did work is pointing to: ~/images/{image}
So the markup would need to look something like:
<asp:Image ID="Image1" ImageUrl='<%# Eval("CategoryImage", "~/images/{0}") %>' runat="server" Height="100" Width="100" />
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
No sir, I have the image on both folders.
I was not intending to have them on both folders but I just wanted to see if any of those would work.
|
|
|
|
|
Hello,
I'm trying to do one page with two listboxes that filers one grid.
The only requirement is that the selection made by the user must be reflected in the URL so that it can be sent by mail to colleagues with the selection already made
The problem is that Load event fires twice.
First time all parameters are transmitted correctly.
The second time the whole QueryString disappears!!
ASPX Directive:
<%@ Page
Language="vb"
uiCulture="en-US"
culture="de-DE"
MasterPageFile="XTAB_WO.master"
AutoEventWireup="false"
CodeFile="LC1vsLC2.vb"
Inherits="LC1vsLC2"
ClientIDMode="Predictable"
%>
ASPX Code:
<asp:listbox clientidmode="Static" id="LstTipo" style="width:150px;height:100px;" runat="server" datasourceid="SqlDataSource2" datatextfield="FLD_RESULTADO" datavaluefield="FLD_RESULTADO">
<asp:listbox clientidmode="Static" id="LstTMA" style="width:150px;height:100px;" runat="server" datasourceid="SqlDataSource4" datatextfield="FLD_MOD3" datavaluefield="FLD_MOD3">
<dx:ASPxGridView ID="gridview1" runat="server" AutoGenerateColumns="true" DataSourceID="SqlDataSource1">
</dx:ASPxGridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyCCnn %>"></asp:SqlDataSource>
<asp:Button ID="Button1" runat="server" Text="Select" style="width:150px;" OnClientClick="Populate();"/>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:hacheConnectionString %>"
SelectCommand="select '(ALL)' FLD_RESULTADO UNION ALL select distinct FLD_RESULTADO from XXXXXXXXXXXXX">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource4" runat="server"
ConnectionString="<%$ ConnectionStrings:hacheConnectionString %>"
SelectCommand="select '(ALL)' FLD_MOD3 UNION ALL select distinct FLD_MOD3 from XXXXXXXXXXXXX">
</asp:SqlDataSource>
<script type="text/javascript" language="javascript">
function removeParam(key, sourceURL) {
var rtn = sourceURL.split("?")[0],
param,
params_arr = [],
queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
if (queryString !== "") {
params_arr = queryString.split("&");
for (var i = params_arr.length - 1; i >= 0; i -= 1) {
param = params_arr[i].split("=")[0];
if (param === key) {
params_arr.splice(i, 1);
}
}
rtn = rtn + "?" + params_arr.join("&");
}
return rtn;
}
function Populate() {
var tma = document.getElementById("LstTMA");
var tipo = document.getElementById("LstTipo");
var fe = "";
var miurl="";
var miurlIni="";
var valor = "";
miurlIni = window.top.location.href + "?";
if (tipo.selectedIndex >= 0) {
var selectedtipo = tipo.options[tipo.selectedIndex].text;
miurl = removeParam("tipo", miurl);
valor = (selectedtipo == "(ALL)") ? '0' : selectedtipo;
miurl = miurl + "&tipo=" + valor.replace(" ","_");
}
if (tma.selectedIndex >= 0) {
var selectedtma = tma.options[tma.selectedIndex].text;
miurl = removeParam("tma", miurl);
valor = (selectedtma == "(ALL)") ? '0' : selectedtma;
miurl = miurl + "&tma=" + valor;
}
window.top.location.href = miurlIni + miurl.substring(1,999);
}
</script>
CODE-BEHIND:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim q As String, q_count As String, x As Integer, NumR As Long
Dim dv As Object
Dim mpContentPlaceHolder As ContentPlaceHolder
Dim ddlRp As ASPxRoundPanel
Dim LstTipo As ListBox, StTipo As String
Dim LstTMA As ListBox, StTma As String
mpContentPlaceHolder = CType(Master.FindControl("ContentHolder"), ContentPlaceHolder)
If Not mpContentPlaceHolder Is Nothing Then
ddlRp = CType(mpContentPlaceHolder.FindControl("ASPxRoundPanel3"), ASPxRoundPanel)
If Not ddlRp Is Nothing Then
LstTipo = CType(ddlRp.FindControl("LstTipo"), ListBox)
LstTMA = CType(ddlRp.FindControl("LstTMA"), ListBox)
End If
End If
If Request.QueryString.Count > 0 AndAlso ((Not Request.QueryString("pais") Is Nothing) Or (Not Request.QueryString("y4m2d2") Is Nothing) Or (Not Request.QueryString("tipo") Is Nothing) Or (Not Request.QueryString("tma") Is Nothing)) Then
StTipo = "" : StTma = "" ': Sty4m2d2 = ""
If Not (Request.QueryString("tipo") Is Nothing) AndAlso Request.QueryString("tipo").ToString() <> "" Then
If Request.QueryString("tipo") = "0" Then
LstTipo.SelectedValue = "(ALL)"
StTipo = ""
Else
LstTipo.SelectedValue = Replace(Request.QueryString("tipo"), "_", " ")
StTipo = " AND FLD_RESULT='" & Replace(Request.QueryString("tipo"), "_", " ") & "'"
End If
End If
If Not (Request.QueryString("tma") Is Nothing) AndAlso Request.QueryString("tma").ToString() <> "" Then
If Request.QueryString("tma") = "0" Then
LstTMA.SelectedValue = "(ALL)"
StTma = ""
Else
LstTMA.SelectedValue = Replace(Request.QueryString("tma"), "_", " ")
StTma = " AND FLD_MOD3='" & Replace(Request.QueryString("tma"), "_", " ") & "'"
End If
End If
q = "SELECT " & StFieldsQuery & " FROM V_BUDA_LC1vsLC2 WHERE 1=1 " & StTipo & StTma '& Sty4m2d2 '& " ORDER BY FLD_ID"
q_count = "SELECT count(*) NumR FROM V_BUDA_LC1vsLC2 where 1=1 " & StTipo & StTma '& Sty4m2d2
SqlDataSource11.SelectCommand = q_count
dv = CType(SqlDataSource11.Select(DataSourceSelectArguments.Empty), DataView)
NumR = CType(dv.Table.Rows(0)(0), Integer)
If (NumR > 0) Then
SqlDataSource1.SelectCommand = q
gridview1.Visible = True
LblNoData.Visible = False
Else
gridview1.Visible = False
LblNoData.Visible = True
End If
Else
gridview1.Visible = True
LblNoData.Visible = False
q = "SELECT * FROM V_BUDA_LC1vsLC2 WHERE 1=0"
SqlDataSource1.SelectCommand = q
End If
Page.DataBind()
End Sub
|
|
|
|
|
|
|
That image shows the test on your local system. Please provide details of the test that produces the error.
|
|
|
|
|
|
Hi,
We are using Git Source Control for our project, for some reason we got a mess in our main branch when we were taking files from two branches, I want to check if there is any tool that can show us, the files that are different in two given branches if we put, just file names are enough for me, if it can show more details like what are those differences, that's also good, but if at least it shows me the files that are different it would be great.
|
|
|
|
|
|
my vs tool is : Visual Studio Community 2017 for Mac
Version 7.8.3 (build 2)
compile detail error: Error CS1056: Unexpected character '�' (CS1056)
how to fix this issue?
|
|
|
|
|
You have an invalid character in the source file that you are trying to compile. The message should include a line and character number telling you where the problem lies.
|
|
|
|
|
Hello
I am just wondering why, if I have these lines of code in my aspx file
<asp:label id="LblDate" runat="server" cssclass="dateStyle" text="Label">
<asp:panel id="pnlFormFields" runat="server">
<asp:panel id="pnlThankYouMessage" runat="server" cssclass="panel" visible="False">
why I would get the following red underlined errors (VS 2017) in my corresponding aspx.vb file:
pnlFormFields.Visible = False
pnlThankYouMessage.Visible = True
LblDate.Text = ReturnDate()
Not declared or inaccessible due to protection levels.
What should I have, please?
Thanks!
|
|
|
|
|
The most likely cause is that your controls are declared inside a data-bound control - FormView , GridView , ListView , etc.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks, Richard, for replying.
I have this:
Function ReturnDate() As String
Code for ordinal date
End Function
And then:
Protected Sub SendEmail_Click(sender As Object, e As System.EventArgs)
SMTP code here
End Sub
And this, where the errors occur:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'user_name.Focus()
pnlFormFields.Visible = False
pnlThankYouMessage.Visible = True
LblDate.Text = ReturnDate()
End Sub
The forms tell the user 'thank you' when he clicks on 'Send' (the form), but I didn't think it would be part of the SMTP
Protected Sub SendEmail_Click , and I didn't think the 'show date'would be part of the Date Function, so I put the three lines of code above (the ones with the errors) in that
Protected Sub Page_Load
.
Thanks again.
|
|
|
|
|
As I said, the problem is most likely that your controls are part of a data-bound control. That's in the .aspx file, not the .aspx.vb file.
The other option would be if the CodeFile or Inherits attributes on the <%@ Page ... %> directive don't match the code-behind file.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That's now working fine, Richard, many thanks.
|
|
|
|
|
I am trying this from many days with no success,
User first fills the registration form and after clicking submit, all JavaScript validations should fire (no field should be blank and all fields should meet criteria) and after that,all details must be saved in database (SQL)server( created table in database) and grid view must be displayed.
1. In grid view, there must be two links (select and delete) starting of every row and also one addnew button on top of the grid view.
2. when clicked on addnew button, it should display only registration form with all empty fields and submit&reset buttons(Grid view should not be visible here, only form).
3. when clicked on select link, the selected row details must appear in registration form with corresponding field values inside text boxes and after modifying those details and clicked on update button( update button must be visible below registration form only) , details must bt updated to data base.
Validation part is completed and delete also working fine.
Can any one help me with remaining query?
|
|
|
|
|
Suppose I create an asp.net website project that loads data into griview from the class library, declaring the library to use loading data for griview
//file: ChitietSP.aspx
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Diagnostics; // Debug
using connectSQL; // warning
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadData();
}
}
string sSQL;
private void LoadData()
{
sSQL = "SELECT * FROM TABKHACHHANG ";
sSQL += "ORDER BY MASOPHIEU;";
GridView1.DataSource = ClsConnecSQL.FillDatatable(sSQL);
}
}
//file: clsConnecSQL.cs
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//using connectSQL;
namespace connectSQL
{
public class ClsConnecSQL
{
public static DataTable FillDatatable(string sSQL)
{
//Do somthing...
}
}
}
I have declared the library namespace to be used is still error, asking you to help me
using connectSQL; // warning
GridView1.DataSource = ClsConnecSQL.FillDatatable (sSQL); // error not found connectSQL namespace
|
|
|
|
|
What is the error or warning that you see and where does it occur?
|
|
|
|
|
using connectSQL;
GridView1.DataSource = FillDatatable (sSQL);
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|