Hi Coding Experts
I have a Grid view, where i have set 2 datakeys( Travel Id and location).
I'm hiding TravelID column, but displaying location in the gridview.On selection of the location,i want to display Location in a textbox, but still have the travelid in a variable.Travelid is a GUID.
I'm not able to get The location in the text box.
here is the piece of code i'm using to get the values:
Also, If i have large number of locations(rows), will the Onselectedchange event handler be the right one to use?
Help Appreciated, Thanks in advance...
Protected Sub GrdLocation_SelectedindexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GrdLocation.SelectedIndexChanged
Dim TravelId As Guid
TravelId = Me.GrdLocation.DataKeys(GrdLocation.SelectedIndex).Value("TravelLocID") .....This gives me an error saing out of index
TravelId = Me.GrdLocation.DataKeys(e.CommandArgument).Value() ......This give me error saying command argument is not a part of Selected indexchanged
'TxtLocation.Text = Me.GrdLocation.DataKeys(GrdLocation.SelectedIndex).Value("Destination").ToString. .....does not get the value says index out of range
Dim row As GridViewRow = GrdLocation.SelectedRow
TxtLocation.Text = row.Cells(1).Text.ToString ...No Errors but not able to get the value in text box