How do I get the Primary Key of the row in which a radio button is selected. I have tried:
However the IDImages value is empty.
ANy help appreciated.
Protected
Sub
rbt_VehicleImage_CheckedChanged(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Dim
item
As
GridDataItem =
DirectCast
(TryCast(sender, RadioButton).NamingContainer, GridDataItem)
Dim
rdBtn
As
RadioButton = TryCast(sender, RadioButton)
If
rdBtn.Checked =
True
Then
Dim
sql
As
String
Dim
strConnString
As
[
String
] = System.Configuration.ConfigurationManager.ConnectionStrings(
"CF_SQL_Connection"
).ConnectionString()
sql =
"UPDATE CF_Images SET DefaultImage = @Value WHERE IDVehicles = 175"
Dim
connection
As
New
SqlConnection(strConnString)
Dim
command
As
New
SqlCommand(sql, connection)
command.Parameters.Add(
"@Value"
, SqlDbType.Int).Value =
"0"
command.Connection.Open()
command.ExecuteNonQuery()
command.Connection.Close()
Dim
sql1
As
String
Dim
strConnString1
As
[
String
] = System.Configuration.ConfigurationManager.ConnectionStrings(
"CF_SQL_Connection"
).ConnectionString()
sql1 =
"UPDATE CF_Images SET DefaultImage = @Value WHERE IDVehicles = 175 AND IDImages = @IDImages"
Dim
connection1
As
New
SqlConnection(strConnString1)
Dim
command1
As
New
SqlCommand(sql1, connection1)
command1.Parameters.Add(
"@Value"
, SqlDbType.Int).Value =
"1"
command1.Parameters.Add(
"@IDImages"
, SqlDbType.Int).Value = 333
command1.Connection.Open()
command1.ExecuteNonQuery()
command1.Connection.Close()
Dim
ID
As
GridBoundColumn =
DirectCast
(rg_VehicleImages.MasterTableView.GetColumn(
"IDImages"
), GridBoundColumn)
Dim
ID2
As
String
= Convert.ToString(ID)
Label1.Text = ID2
Else
End
If
End
Sub
End
Class
However the IDImages value is empty.
ANy help appreciated.