I have a page "Tracking.aspx" which loads a Radgrid with employee work details(say id(hidden),employee_id, employee_name, hours_worked, date_worked)
Example entries:
id employee_id employee_name hours_worked date_worked
1 1 Emp1 5 1/1/2015
2 1 Emp1 2 2/1/2015
3 2 Emp2 6 1/1/2015
4 2 Emp2 8 2/1/2015
Now, I'm trying to add a functionality to this page. If the user wants to make a new entry very similar to id '4', then he has to click on the Employee_name column of that row, which will open the page in insert mode(we have a separate user control for Insert, "TrackingAddForm.ascx"), with the details of the id '4' populated in it.
This is what I have done so far:
1) I have managed to change the employee name column from 'telerik:GridBoundColumn' into 'telerik:GridHyperLinkColumn'
<telerik:GridHyperLinkColumn DataTextField ="Employee" DataNavigateUrlFields = "ID" DataNavigateUrlFormatString="Tracking.aspx?blank=Employee&id={0}"
FilterControlAltText="Filter Employee column" HeaderText="Employee"
SortExpression="Employee" UniqueName="Employee">
2) When this link is clicked, I'm collecting the ID from the Request.QueryString and fetching the data for the corresponding ID.
3) I have opened the same "Tracking.aspx" page in the Insert Mode, so that the user control "TrackingAddForm.ascx" is shown in the "Tracking.aspx". (used the below code)
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
RadGrid1.MasterTableView.IsItemInserted = true;
RadGrid1.Rebind();
}
}
Now what I'm NOT ABLE to do is:
4) Populate the fields of the user control "TrackingAddForm.ascx" with the data fetched in step (2).
So my question is,
a) While opening the page in Insert Mode(by clicking a 'GridHyperLinkColumn' Employee), is there a way to populate the fields of the Insert UserControl ?
b) If any of the above steps I have taken is wrong or if there is a better approach to do the same thing, please let me know.
Thanks in Advance