Hi all
The page I'm doing is a little complicated but I will try to explain what I need to achieve.
1. On the page there is an UpdatePanel ("upTimeRegs") with a RadGrid, where each row has an ID and a link.
2. When the mouse is over a link, a ToolTip ("ToolTipManager") should appear with contents based on the row's ID.
3. The content of the ToolTip is a user control ("ucTimeRegistrations") with another RadGrid ("RadGridTimeRegistrations") which has it's data bound in the NeedDataSource event handler
4. In the second RadGrid one of the columns is a RadComboBox. For each RadComboBox OnSelectedIndexChanged the main RadGrid should be updated
The problems I have:
1. The ToolTip is loaded fine the first time the mouse is over a link, but then when I hover a second link the content of the tooltip is not changed because the NeedDataSource event is not triggered.
2. The main RadGrid is not being updated when the selected index of a combobox is changed.
Here is some of the code I'm using:
Thanks,
Stefan
The page I'm doing is a little complicated but I will try to explain what I need to achieve.
1. On the page there is an UpdatePanel ("upTimeRegs") with a RadGrid, where each row has an ID and a link.
2. When the mouse is over a link, a ToolTip ("ToolTipManager") should appear with contents based on the row's ID.
3. The content of the ToolTip is a user control ("ucTimeRegistrations") with another RadGrid ("RadGridTimeRegistrations") which has it's data bound in the NeedDataSource event handler
4. In the second RadGrid one of the columns is a RadComboBox. For each RadComboBox OnSelectedIndexChanged the main RadGrid should be updated
The problems I have:
1. The ToolTip is loaded fine the first time the mouse is over a link, but then when I hover a second link the content of the tooltip is not changed because the NeedDataSource event is not triggered.
2. The main RadGrid is not being updated when the selected index of a combobox is changed.
Here is some of the code I'm using:
protected void ToolTipManager_OnAjaxUpdate(object sender, ToolTipUpdateEventArgs args) |
{ |
Control ctrl = Page.LoadControl("~/UserControls/ucTimeRegistrations.ascx"); |
args.UpdatePanel.ContentTemplateContainer.Controls.Add(ctrl); |
ucTimeRegistrations TimeRegistrations = (ucTimeRegistrations)ctrl; |
TimeRegistrations.TaskID = Convert.ToInt32(args.Value); |
} |
public partial class ucTimeRegistrations : UserControl |
{ |
public int TaskID; |
protected void Page_Load(object sender, EventArgs e) |
{ |
} |
protected void RadGridTimeRegistrations_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
{ |
RadGTimeRegistrations.DataSource = TimeRegistrationHandler.GetTimeRegistrationsFromDB(TaskID); |
} |
protected void RadComboBoxActivity_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e) |
{ |
RadComboBox rcbActivity = (RadComboBox)sender; |
GridDataItem Row = (GridDataItem)rcbActivity.Parent.Parent; |
if (Row != null) |
{ |
int TimeRegistrationID = Convert.ToInt32(Row["TimeRegistrationID"].Text); |
int ActivityID = Convert.ToInt32(e.Value); |
TimeRegistrationHandler.UpdateTimeRegistration(TimeRegistrationID, ActivityID); |
UpdatePanel upTimeRegs = (UpdatePanel) FindControlRecursive(Page, "upTimeRegs"); |
upTimeRegs.Update(); |
} |
} private Control FindControlRecursive(Control rootControl, string Id) { if (rootControl.ID == Id) return rootControl; foreach (Control childControl in rootControl.Controls) { Control foundControl = FindControlRecursive(childControl, Id); if (foundControl != null) return foundControl; } return null; } |
} |
Thanks,
Stefan