Этот баннер — требование Роскомнадзора для исполнения 152 ФЗ.
«На сайте осуществляется обработка файлов cookie, необходимых для работы сайта, а также для анализа использования сайта и улучшения предоставляемых сервисов с использованием метрической программы Яндекс.Метрика. Продолжая использовать сайт, вы даёте согласие с использованием данных технологий».
Политика конфиденциальности
|
|
|
Опять редктирование в GridView
|
|||
|---|---|---|---|
|
#18+
Необходимо сделать редактирование в GridView, имеется одна ячейка у которой в обычном режиме выводится гиперссылка, а в режиме редактирования должно быть поле: <asp:TemplateField HeaderText="Название" > <ItemTemplate> <asp:HyperLink ID="HyperLink1" runat="server"></asp:HyperLink> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.name")%>'></asp:TextBox> </EditItemTemplate> </asp:TemplateField> Обработчик на событие перевода строки в режим редактирования: void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { GridView1.EditIndex = e.NewEditIndex; BindData(); } //Обработчик события прикрепления данных к GridView protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { HyperLink link = (HyperLink)e.Row.FindControl("HyperLink1"); link.NavigateUrl = "http://auto2.uralsoft.wtn.ru/man/shop/listmad.aspx?id=" + Convert.ToString(ds.Tables["Equipment"].Rows["id"]); link.Text = "dd"; link.Text = Convert.ToString(ds.Tables["Equipment"].Rows[i]["name"]); i++; } } //Метод непосредственного выполнения запроса protected void BindData() { string str; str = ConfigurationSettings.AppSettings["Constr"]; conn = new SqlConnection(str); conn.Open(); ad = new SqlDataAdapter("Select * from type_equip", conn); SqlCommandBuilder cmd = new SqlCommandBuilder(ad); ds = new DataSet(); ad.Fill(ds, "Equipment"); GridView1.DataSource = ds; GridView1.DataBind(); conn.Close(); } Выводится в сё нормально, но при переводе строки в режим редактирования выводится таоке вот ообщение: [i]Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 04.07.2006, 13:36 |
|
||
|
Опять редктирование в GridView
|
|||
|---|---|---|---|
|
#18+
На какую строку выводится?/**********Comments***************************/ We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things: #1) Respect the privacy of others. #2) Think before you type. #3) With great power comes great responsibility. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 04.07.2006, 14:40 |
|
||
|
Опять редктирование в GridView
|
|||
|---|---|---|---|
|
#18+
После перевода строки в режим редактирования, в GridView1_RowDataBound не находит HyperLink1, вот и ошибка ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 04.07.2006, 14:58 |
|
||
|
|

start [/forum/topic.php?fid=18&msg=33830271&tid=1392061]: |
0ms |
get settings: |
10ms |
get forum list: |
18ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
33ms |
get topic data: |
10ms |
get forum data: |
3ms |
get page messages: |
46ms |
get tp. blocked users: |
1ms |
| others: | 253ms |
| total: | 380ms |

| 0 / 0 |
