그래,이 웹 사이트가 있는데 코드 뒤에 선언 된 여러 개의 배열이 있습니다. 나는 그들을 aspx 페이지에서 사용하려고 노력하고 있지만 일단 제 2 수준 div 요소로 내려 가면 액세스 할 수 없다고 알려줍니다. 참조 코드 : 뒤에보호 수준으로 인해 페이지 필드에 액세스 할 수 없습니다.
코드 :
<a href="BlogPosts.aspx" id="iview">
<!-- Slide 1 -->
<div data-iview:image="placeImages/" + <%= strFilePath[0] %>>
<!-- Caption 1 -->
<div class="iview-caption" data-x="400" data-y="400"
data-transition="wipeRight" data-speed="700">
<h3><%= strTitle[0] %></h3>
<%= strCity[0] %>, <%= strCountry[0] %>
</div>
</div>
그래서 strTitle
, strCity
및 strCountry
이 인해 보호 수준에 액세스 할 수없는 것을 저에게 말한다, 그러나 strFilePath
는 : 여기
string[] strFilePath = new string[5];
string[] strTitle = new string[5];
string[] strCity = new string[5];
string[] strCountry = new string[5];
protected void Page_Load(object sender, EventArgs e)
{
string constr =
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\TravelJoansDB.mdb;";
string cmdstr = "SELECT TOP 5 * FROM Table2 ORDER BY TravelDate";
OleDbConnection con = new OleDbConnection(constr);
OleDbCommand com = new OleDbCommand(cmdstr, con);
con.Open();
OleDbDataReader reader = com.ExecuteReader();
for (int i = 0; i < 5; i++)
{
reader.Read();
strFilePath[i] = reader[2].ToString();
strTitle[i] = reader[6].ToString();
strCity[i] = reader[7].ToString();
strCountry[i] = reader[8].ToString();
}
}
그리고는 ASP입니다 시원한. div 엘리먼트의 클래스 속성 때문이라고 느낀다. 그렇다면 주위를 둘러 쌀 수있는 방법이 있습니까? 나는 "this"를 사용해 보았지만, 역시 작동하지 않았다.
div의 CSS 클래스는 코드 숨김 변수의 범위에 영향을주지 않습니다. – mason
알아두면 좋을 것 같습니다. 내 문제에 대한 아이디어가 있습니까? – Joseph
ASPX 페이지'data-iview : image = "placeImages /"+ <% = strFilePath [0] %>'에서 이와 같이 문자열을 연결할 수 없습니다. – mason