Форум программистов, компьютерный форум, киберфорум
C#: Web, ASP.NET
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 5.00/4: Рейтинг темы: голосов - 4, средняя оценка - 5.00
0 / 0 / 1
Регистрация: 10.06.2014
Сообщений: 59
1

Ошибка при работе с изображениями: The name 'ResolveUrl' does not exist in the current context

01.07.2014, 18:37. Показов 739. Ответов 1
Метки нет (Все метки)

Author24 — интернет-сервис помощи студентам
Здравствуйте! Нашел пример как работать с изображениями, но выходит ошибка.
Пример: http://msdn.microsoft.com/en-u... 79350.aspx
Код шибки:The name 'ResolveUrl' does not exist in the current context
XML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<asp:GridView ID="GridView1" Runat="server" AutoGenerateColumns="False" 
            BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" 
            CellPadding="3" DataSource="<%# SqlData.GetData() %>" Font-Names="Arial">
            <FooterStyle BackColor="White" ForeColor="#000066" />
            <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
            <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
            <Columns>
                <asp:BoundField DataField="PictureID" HeaderText="Picutre ID">
                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                </asp:BoundField>
                <asp:BoundField DataField="Title" HeaderText="Title" />
                <asp:BoundField DataField="DateAdded" DataFormatString="{0:d}" 
                    HeaderText="Date Added">
                    <ItemStyle HorizontalAlign="Center" />
                </asp:BoundField>
                <asp:ImageField DataImageUrlField="PictureURL">
                </asp:ImageField>
            </Columns>
            <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            <RowStyle ForeColor="#000066" />
        </asp:GridView>
C#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
public static DataTable GetData()
        {
            // This method creates a DataTable with four rows.  Each row has the
            // following schema:
            //   PictureID      int
            //   PictureURL     string
            //   Title          string
            //   DateAdded      datetime
            DataTable dt = new DataTable();
            // define the table's schema
            dt.Columns.Add(new DataColumn("PictureID", typeof(int)));
            dt.Columns.Add(new DataColumn("PictureURL", typeof(string)));
            dt.Columns.Add(new DataColumn("Title", typeof(string)));
            dt.Columns.Add(new DataColumn("DateAdded", typeof(DateTime)));
            // Create the four records
            DataRow dr = dt.NewRow();
            dr["PictureID"] = 1;
            dr["PictureURL"] = ResolveUrl("~/DisplayingImages/Images/Blue hills.jpg");
            dr["Title"] = "Blue Hills";
            dr["DateAdded"] = new DateTime(2005, 1, 15);
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["PictureID"] = 2;
            dr["PictureURL"] = ResolveUrl("~/DisplayingImages/Images/Sunset.jpg");
            dr["Title"] = "Sunset";
            dr["DateAdded"] = new DateTime(2005, 1, 21);
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["PictureID"] = 3;
            dr["PictureURL"] = ResolveUrl("~/DisplayingImages/Images/Water lilies.jpg");
            dr["Title"] = "Water Lilies";
            dr["DateAdded"] = new DateTime(2005, 2, 1);
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["PictureID"] = 4;
            dr["PictureURL"] = ResolveUrl("~/DisplayingImages/Images/Winter.jpg");
            dr["Title"] = "Winter";
            dr["DateAdded"] = new DateTime(2005, 2, 18);
            dt.Rows.Add(dr);
            return dt;
        }
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
01.07.2014, 18:37
Ответы с готовыми решениями:

выдается ошибка the name 'k' does not exist in the current context
using System; using System.Collections.Generic; using System.Linq; using System.Text; ...

ошибка в коде The name 'SaveFileDialog1' does not exist in the current context
написал когд для сохранения данных из datagridview в txt фаил но выдаёт ошибку что нужно сделать?...

Ошибка currentName doesn't exist in the current context
Добрий день! Такой вот метод кидает ошибку при возврате значения. Тоесть когда return...

The name does not exist in the current context
В чем ошибка? using System; using System.Collections.Generic; using System.ComponentModel;...

1
2735 / 2041 / 380
Регистрация: 22.07.2011
Сообщений: 7,731
03.07.2014, 19:22 2
ResolveUrl свойство доступное для экземпляра контрола , а у Вас статический метод.
0
03.07.2014, 19:22
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
03.07.2014, 19:22
Помогаю со студенческими работами здесь

The name 'grid_subject' does not exist in the current context
Выдает ошибку - The name 'grid_subject' does not exist in the current context Как ее...

The name `EditorGUI' does not exist in the current context
using UnityEditor; void OnGUI () { EditorGUI.BeginChangeCheck (); if...

The name 'output' does not exist in the current context
Доброго времени суток! Учусь С# по книге Эндрю Стилмен - Изучаем C#. Там я столкнулся с заданием:...

The name 'port' does not exist in the current context
Всем привет! Изучаю С# 4 час и столкнулся с проблемой которой озаглавлена тема. как я понимаю...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru