473,325 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Getting Link to work in datagrid???

Why doesn't my onEditCommand work???

I don't get an error it just doesn't do the page redirect as requested...

Thanks

...CODE..
Sub LinkButton_OnClick(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs)
If e.Item.Cells(0).Controls.Count > 0 Then ' Edit Link
If TypeOf (e.Item.FindControl("PageEdit")) Is LinkButton Then
Response.Redirect("../default.aspx?ID=1")
End If
End If
End Sub
...Datagrid..
<asp:datagrid id="DGPages" runat="server" BorderColor="LightGray"
GridLines="Horizontal" BorderWidth="1px" BorderStyle="Ridge"
AutoGenerateColumns="False" Width="50%"
CellPadding="4" EditItemStyle-BackColor="#eeeeee"
HeaderStyle-BackColor="Black" HeaderStyle-ForeColor="White"
HeaderStyle-HorizontalAlign="Center"
HeaderStyle-Font-Bold="True" ShowFooter="false" CssClass="txtArea"
AlternatingItemStyle-BackColor="WhiteSmoke"
EnableViewState="False" OnEditCommand="LinkButton_OnClick">
<EditItemStyle BackColor="#EEEEEE"></EditItemStyle>
<AlternatingItemStyle BackColor="WhiteSmoke"></AlternatingItemStyle>
<HeaderStyle Font-Bold="True" HorizontalAlign="Center"
ForeColor="White" BackColor="Black"></HeaderStyle>
<Columns>
<asp:TemplateColumn>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<img src="../images/page.gif">
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Page">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<%# Container.DataItem("header") %>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Description">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<%# Container.DataItem("description") %>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<asp:LinkButton CommandName="Edit" ID="PageEdit"
Runat="server"><img border=0 src=../images/edit.gif alt='Edit
Page'></asp:LinkButton>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<asp:LinkButton ID="PageProperties" Runat="server"><img
border=0 src=../images/properties.gif alt='Page Properties'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>

Nov 19 '05 #1
0 926

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Colin McGuigan | last post by:
This is a translation of an ASP page to ASP.Net. First, the background: The goal is to have a grid of different settings for the application -- think something along the lines of the Property...
3
by: Raymond Lewallen | last post by:
I have a modal dialog displaying a datagrid control. Click on the column header to sort the datagrid opens a new window with the following in the location: ...
2
by: Luis E Valencia | last post by:
I want a row of the datagrid with a personalized link. The fields of the link are on the select related to the datagrid the link would be accoiones.aspx?iddireccion=2&idindicador=5 I tried...
0
by: Luis E Valencia | last post by:
Read from above to top. I didnt understand. This is the code that fills that datagrid Public Sub pasar(ByVal sender As System.Object, ByVal e As...
5
by: Luis E Valencia | last post by:
I need a link on a datagrid, the link must have fields of the database Like this acciones.aspx?iddireccion=1&idindicador=4 Thanks
0
by: Henri | last post by:
Hi, I'm using a DataGrid with ViewState disabled, so I rebind data after each postback from the page's Sub OnLoad. Inside one of the DataGrid column, there is a custom LinkButton to trigger a...
2
by: JenHu | last post by:
hi, I have a datagrid in my asp.net application, I am using vb.net language. I want to have my last column as a link column, link to text file. The link path is "c:\Temp\" & F_File_Name, which...
1
by: BrainTop | last post by:
This is driving me nuts for last one week. Appreciate any assistance. I have ASP.NET web application with many pages. Some of them post back to itself and then links to another page. Everything...
7
by: GaryDean | last post by:
I am writing a method in a component that gets passed a 1.1 Datagrid. The datagrid's columns were created at run time meaning it has no columns collection. How can I access Header and Footer...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.