Hi Tim,
Here's the idea. Let us know if it helps?
Ken
Microsoft MVP [ASP.NET]
Toronto
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
If Not IsPostBack Then
DataGrid1.DataS ource = CreateDataSourc e()
DataGrid1.DataB ind()
End If
End Sub
Private Sub DataGrid1_ItemC ommand _
(ByVal source As Object, _
ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) _
Handles DataGrid1.ItemC ommand
' Check for the right link button
If e.CommandName = "Select" Then
' Build the redirection URL
Response.Redire ct("othersite.a spx?id=" & e.CommandArgume nt)
End If
End Sub
Function CreateDataSourc e() As DataTable
'ProductId
'DownloadURL()
'title()
Dim dt As New DataTable
Dim dr As DataRow
dt.Columns.Add( New DataColumn _
("ProductId" , GetType(Int32)) )
dt.Columns.Add( New DataColumn _
("DownloadUR L", GetType(String) ))
dt.Columns.Add( New DataColumn _
("title", GetType(String) ))
Dim i As Integer
For i = 0 To 8
dr = dt.NewRow()
dr(0) = i
dr(1) = "URL " + i.ToString()
dr(2) = "Item " + i.ToString()
dt.Rows.Add(dr)
Next i
Return dt
End Function 'CreateDataSour ce
<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" runat="server">
<Columns>
<asp:BoundColum n DataField="Prod uctId"
Visible="False" ></asp:BoundColumn >
<asp:BoundColum n DataField="Down loadURL"
Visible="False" ></asp:BoundColumn >
<asp:TemplateCo lumn>
<ItemTemplate >
<asp:LinkButt on ID="lnkArticle "
CommandArgument ='<%#DataBinder .Eval(Container , "DataItem.Produ ctId")%>'
Runat="server" Text='<%#DataBi nder.Eval(Conta iner, "DataItem.Title ")%>'
CommandName="Se lect" />
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:DataGrid>
</form>
"Tim::.." <myatix_at_hotm ail.com> wrote in message
news:BD******** *************** ***********@mic rosoft.com...
Can someone tell me how I do a response.redire ct using a linkbutton in a
datagrid!
I want to use the record id in a database to send a querystring to an HTML
editor so that users are able to edit a particular page they have chosen
from
a datagrid!
EG: If a user clicks the linkbutton in a datagrid it takes you to a page
with the following url...
../editor.aspx?id= 23
Would appritiate any help!
Thanks