|
-
Dec 22nd, 2006, 06:03 AM
#1
Thread Starter
Hyperactive Member
Button column in datagrid
what am I missing?! Im trying to add a column with an "edit" button into my datagrid?!
'html creating datagrid
<asp:datagrid id="DataGrid1"
style="Z-INDEX: 101; LEFT: 56px; POSITION: absolute; TOP: 280px"
runat="server" Width="720px" Height="20px" Font-Size="10pt" Font-Names="Arial"
AutoGenerateColumns="False"
OnItemCommand="Click_Grid">
<Columns>
<asp:BoundColumn DataField="PickListNo" HeaderText="Pick List"></asp:BoundColumn>
<asp:BoundColumn DataField="Type" HeaderText="Pick List Type"></asp:BoundColumn>
<asp:BoundColumn DataField="Description" HeaderText="Stage Description"></asp:BoundColumn>
<asp:ButtonColumn Text="Edit" ButtonType="PushButton"></asp:ButtonColumn>
</Columns>
</asp:datagrid>
' sub from vb code:
Sub Click_Grid(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)
Label5.Text = "You selected " _
& E.Item.Cells(2).Text & " " _
& E.Item.Cells(1).Text & "<BR>"
DataGrid1.Visible = False
End Sub
When I run the form, it seems to not relate the two together, and does nothing... what am I doing wrong... I have following several links but cant seem to see what is wrong!
-
Dec 22nd, 2006, 02:20 PM
#2
Re: Button column in datagrid
Hi,
You can use the DatagridColumnCollection.Add Method, here's the link;
http://msdn2.microsoft.com/en-us/lib...ction.add.aspx
Hope it helps,
sparrow1
-
Dec 22nd, 2006, 04:48 PM
#3
Re: Button column in datagrid
I don't see anything wrong with the code... By any chance, did you set Label5.Visible = False somewhere and forget to turn it back to True?
-
Jan 2nd, 2007, 04:25 AM
#4
Thread Starter
Hyperactive Member
Re: Button column in datagrid
 Originally Posted by stanav
I don't see anything wrong with the code... By any chance, did you set Label5.Visible = False somewhere and forget to turn it back to True?
Soz for the late reply.... no I do not set the visibility to false no where in the code...still dont know why it doesnt wrk!
-
Jan 2nd, 2007, 08:44 AM
#5
Thread Starter
Hyperactive Member
Re: Button column in datagrid
seems to be an error when creating the column, I "manually" added the row and it all seems to work!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|