View Single Post
  #25 (permalink)  
Old July 15th, 2011, 04:39 AM
priti2010 priti2010 is offline
Authorized User
Points: 63, Level: 1
Points: 63, Level: 1 Points: 63, Level: 1 Points: 63, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2011
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Please find the detail

no i have not set any datakeys
please let me know how to set a datakey value
and in my rowindex the e value is 0
Service_ID = DataGridOdin.DataKeys(e.RowIndex).Value.ToString()
and exception error is show that index value is out of range....
my datagird table look as this
my design contains a textbox and 2 checkboxlist which accepts only the bits values
Service_ID Service_Name NSE BSE NSE_FO MCX MCX_SX NCDEX NSE_SX Manager_1 Manager_2 MIS_101 MIS_102
1 jdjkd 1 1 1 1 1 1 1 1 1 1 1
2 bgftht 1 1 1 1 0 1 0 1 0 1 0
3 hgthf 1 1 1 0 1 1 1 1 1 0 1
4 fgdgd 1 1 1 1 1 1 1 1 1 0 1
and this is how i am binding a data
Public Function GetData() As DataTable
Try
myconnection.ConnectionString = sqlConStr
If myconnection.State <> ConnectionState.Open Then myconnection.Open()
mycommand = New SqlCommand("sp_Service", myconnection)
mycommand.CommandType = CommandType.StoredProcedure
mycommand.Connection = myconnection
pnlview.Visible = True
DataGridOdin.Visible = True
datareader = mycommand.ExecuteReader
da = New DataTable("tbl_Service")
da.Load(datareader)
DataGridOdin.DataSource = da
DataGridOdin.DataBind()

Catch ex As Exception
Response.Write(ex.Message)
End Try
Return da

End Function