I have a 2 level hiearchy grid. The detail table has a commanditemtemplate with a link inside for add item. I am needing to add an onclick javascript event to this in the code behind and get the datakeyvalue of the master table row that we are adding to. So for instance
MasterTable = Schedule
DetailTable = Event
Key = ScheduleID
When i databind the event datasource i want to use the event to grab the ScheduleID from the mastertable row and add it to a javascript call ShowEditForm(ScheduleId)
How can I get the key in the commanddataitem?
I am already grabbing the link and inserting a fake call that works - but I need that darn key? Any thoughts how i can get it here? I know how to get it if i'm in a griddataitem but not here?
MasterTable = Schedule
DetailTable = Event
Key = ScheduleID
When i databind the event datasource i want to use the event to grab the ScheduleID from the mastertable row and add it to a javascript call ShowEditForm(ScheduleId)
How can I get the key in the commanddataitem?
I am already grabbing the link and inserting a fake call that works - but I need that darn key? Any thoughts how i can get it here? I know how to get it if i'm in a griddataitem but not here?
If TypeOf (e.Item) Is GridCommandItem And e.Item.OwnerTableView.DataSourceID = "SqlDates" Then
Dim dataitem As GridCommandItem = CType(e.Item, GridCommandItem)
Dim hypr As HyperLink = CType(dataitem.FindControl("AddLink"), System.Web.UI.WebControls.HyperLink)
hypr.Attributes(
"onclick") = [String].Format("return ShowEditForm('{0}'", 0)
'editLink.Attributes("onclick") = [String].Format("return ShowEditForm('{0}','{1}');", dataitem("MessageId").Text, e.Item.ItemIndex)
End If