Is it possible to return a parentID values that are loaded dynamically (MS SQL server)?
I’m using the code below but I’m only getting values from the items that are within the tab.
Protected Sub RadPanelbar_ItemClick(ByVal sender As Object, ByVal e As Telerik.WebControls.RadPanelbarEventArgs) Handles RadPanelBar.ItemClick
Dim ItemClicked As Telerik.WebControls.RadPanelItem = e.Item
End Select
Response.Write("Server event raised -- you clicked: " + CStr(ItemClicked.Value))
End Sub
| private void AddDocks(string text) |
| { |
| RadDock dock = CreateRadDock(text); |
| //In order to optimize the execution speed we are adding the dock to a |
| // hidden update panel and then register a script which will move it |
| // to RadDockZone1 after the AJAX request completes. If you want to |
| // dock the control in other zone, modify the script according your needs. |
| UpdatePanel1.ContentTemplateContainer.Controls.Add(dock); |
| ScriptManager.RegisterStartupScript( |
| dock, |
| this.GetType(), |
| "AddDock", |
| string.Format(@"function _addDock() {{ |
| Sys.Application.remove_load(_addDock); |
| $find('{1}').dock($find('{0}')); |
| $find('{0}').doPostBack('DockPositionChanged'); |
| }}; |
| Sys.Application.add_load(_addDock);", dock.ClientID, RadDockZone1.ClientID), |
| true); |
| //Right now the RadDock control is not docked. When we try to save its state |
| // later, the DockZoneID will be empty. To workaround this problem we will |
| // set the AutoPostBack property of the RadDock control to true and will |
| // attach an AsyncPostBackTrigger for the DockPositionChanged client-side |
| // event. This will initiate second AJAX request in order to save the state |
| // AFTER the dock was docked in RadDockZone1. |
| CreateSaveStateTrigger(dock); |
| } |
| protected void ButtonAddDock_Click(object sender, EventArgs e) |
| { |
| List<string> array = new List<string>(); |
| array.Add("test1"); |
| array.Add("test2"); |
| array.Add("test3"); |
| for (int i = 0; i < array.Count; i++) |
| { |
| AddDocks(array[i].ToString()); |
| } |
| } |
| private RadDock CreateRadDock(string text) |
| { |
| int docksCount = CurrentDockStates.Count; |
| RadDock dock = new RadDock(); |
| dock.UniqueName = Guid.NewGuid().ToString(); |
| dock.ID = string.Format("RadDock{0}", dock.UniqueName); |
| dock.Title = "Dock"; |
| dock.Text = text; |
| dock.Width = Unit.Pixel(300); |
| dock.Commands.Add(new DockCloseCommand()); |
| dock.Commands.Add(new DockExpandCollapseCommand()); |
| dock.Command += new DockCommandEventHandler(dock_Command); |
| return dock; |
| } |
|
|
|

<
telerik:RadGrid ID="RadGrid1" OnColumnCreated="RadGrid1_ColumnCreated" runat="server" style="text-align: left" AutoGenerateColumns="False" GridLines="None">
<MasterTableView>
<RowIndicatorColumn Visible="False">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn Resizable="False" Visible="False">
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<EditFormSettings>
<PopUpSettings ScrollBars="None" />
</EditFormSettings>
<Columns>
<telerik:GridBoundColumn DataField="SKU" HeaderText="SKU"
UniqueName="gcolumn1" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Description" HeaderText="Description"
UniqueName="gcolumn2" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Orig Qty" HeaderText="Orig Qty"
UniqueName="gcolumn3" >
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Shiped Qty" HeaderText="Shiped Qty"
UniqueName="gcolumn4" >
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
I want to allow sorting for just my first column. but code is not working.
Protected Sub RadGrid1_ColumnCreated(ByVal sender As Object, ByVal e As GridColumnCreatedEventArgs) Handles RadGrid1.ColumnCreated
If TypeOf e.Column Is GridHyperLinkColumn Then
Dim col As GridHyperLinkColumn = DirectCast(e.Column, GridHyperLinkColumn)
If col.UniqueName = "gcolumn1" Then
col.SortExpression =
True
End If
End If
End Sub
protected
void myGrid_DeleteCommand(object source, GridCommandEventArgs e)
{
if
(e.Item.OwnerTableView.DataMember == "Orders")
{
DataRow[] deleteRow = AssignmentRailItemDS.Tables["Orders"].Select("OrderID = " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["OrderID"]);
deleteRow[0].Delete();
}
else if (e.Item.OwnerTableView.DataMember == "Products")
{
DataRow[] deleteChildRow = AssignmentRailItemDS.Tables["Products"].Select("ProductID = " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["ProductID"]);
deleteChildRow[0].Delete();
}
}
Is this the right approach?
Can I have a working example of the insert/delete operations?