Hi Lloyd,
Here's some code that might get you going with items 2 and 3 on your list.
You just need to count the rows and columns (starting at 0) and insert the
values. Then you can read and write to that cell. Let us know if this helps?
Ken
Microsoft MVP [ASP.NET]
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
If Not IsPostBack Then
DataGrid1.DataSource = CreateDataSource()
DataGrid1.DataBind()
End If
End Sub
Private Sub Button1_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button1.Click
Label1.Text = _
DataGrid1.Items(5).Cells(3).Text
End Sub
Function CreateDataSource() As DataTable
Dim dt As New DataTable
Dim dr As DataRow
dt.Columns.Add(New DataColumn _
("IntegerValue", GetType(Int32)))
dt.Columns.Add(New DataColumn _
("StringValue", GetType(String)))
dt.Columns.Add(New DataColumn _
("CurrencyValue", GetType(Double)))
dt.Columns.Add(New DataColumn _
("Boolean", GetType(Boolean)))
Dim i As Integer
For i = 0 To 8
dr = dt.NewRow()
dr(0) = i
dr(1) = "Item " + i.ToString()
dr(2) = 1.23 * (i + 1)
dr(3) = (i = 4)
dt.Rows.Add(dr)
Next i
Return dt
End Function 'CreateDataSource
Private Sub Button2_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Button2.Click
DataGrid1.Items(5).Cells(3).Text = "Custom Text"
End Sub
<form id="Form1" method="post" runat="server">
<asp:DataGrid id="DataGrid1" runat="server"></asp:DataGrid>
<P>
<asp:Label id="Label1" runat="server">Label</asp:Label></P>
<P>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P>
<P>
<asp:Button id="Button2" runat="server" Text="Custom
Text"></asp:Button></P>
</form>
Ken
[quoted text, click to view] "lloyd" <lloydmonteiro@rediffmail.com> wrote in message
news:e783765f.0405270945.2a73fab7@posting.google.com...
>i got couple of dotNet questions pertaining to dataGrid, if you could
> help me out.
>
> 1) how do i store more than one key value in the DATAKEY element. So
> far from what i have seen it doesnot seem possible, this is to store
> composite primary keys? i have found out that i need to join the
> composite values with a delimiter in the sql statement and then bind
> it. is it not possible to do it in any other way ??
>
> 2) i need to access lets say the contents of the 4 row 5th column of a
> datagrid and this is to be accessed on a button click, not on any of
> the datagrid events. How do i do this ??
>
> 3) if i needed to access the contents of the 4th row 5th column in the
> dataGRid event. How do i do this??
>
> Please help me out, i am kinda stuck