|
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.
|
|
|
|
|
|
without errors as you described, I have an error not finding the derived class:
GridView1.DataSource = clsConnecSQL.FillDatatable(sSQL); //It's not find clsConnecSQL.xxx ???
|
|
|
|
|
in winForm I declare as above is a good run but in asp.net webForm why don't I understand the namespace, get rid of errors:
The type or namespace name 'connectSQL' could not be found (are you missing a using directive or an assembly reference?)
modified 19-Mar-19 0:02am.
|
|
|
|
|
Good day everyone!
This is one of the programming issue that I have ever faced and got totally confused about the right keywords to use. I want to capture the keywords that online users searching using any of the search engines used. Base on the keywords, I then make a search query on my webpage then display the appropriate result instead of irrelevant information.
For instance, if some searched for Building a happy home and my site luckily appears on SERP, by luck, the user clicks on site link; I would like to get the question Building a happy home then on my webpage make a search as
Dim key_Word as String
SELECT*FROM tablename WHERE columnName = key_Word
I tried UrlReferrer.ToString and Request.Urlreferrer.Host as suggested in some sites but returns only www.google.com without the question
Please how do I achieved this?
|
|
|
|
|
I think most search engines stop you doing this now, they want you to use their own tools to see that data.
|
|
|
|