GetRadWindow().BrowserWindow.setValue(gup(
'TargetControlID'), value);
gup is just a function that returns the parameter value from the querstring.
THe problem is that when I use the above code from radwindow2 in order to set a value on Radwindow1, I get a javascript error. I think this is because the object returned by GetRadWindow().BrowserWindow is not the same as if I were just one radwindow deep.
How should I change the code to set a value on the parent window of a radwindow when the parent that is also a radwindow?
Thanks
Jonathan
<
telerik:RadPanelBar ID="RadPanelBar1" runat="server">
<Items>
<telerik:RadPanelItem Text="Travelers" Value="Travelers" Expanded="true">
<Items>
<telerik:RadPanelItem>
<ItemTemplate>
<asp:Button ID="ColorPicker" OnClientClick="GetbtnTEST();" runat="server" Text="TEST"/>
<telerik:RadColorPicker ID="sdColorPicker" runat="server"></telerik:RadColorPicker>
</ItemTemplate>
</telerik:RadPanelItem>
</Items>
</telerik:RadPanelItem>
</Items>
</telerik:RadPanelBar>
right now the button calls this on the onclick, but this will not be the case later. I can't use the this keyword
function GetbtnTEST(){
var panelbar = $find("<%= RadPanelBar1.ClientID %>");
var item = panelbar.findItemByValue("Travelers");//I need to find by value because we use language files for Text
var objBtn = item.findControl("ColorPicker");
alert('objBtn = ' + objBtn);//Always null!
}
Someone please help...this is driving me nuts!
| <asp:LinqDataSource ID="LinqDataSource1" runat="server" |
| ContextTypeName="NWExample.DataClasses1DataContext" |
| EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="Customers"> |
| </asp:LinqDataSource> |
| <asp:LinqDataSource ID="LinqDataSource2" runat="server" |
| ContextTypeName="NWExample.DataClasses1DataContext" |
| EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="Orders" |
| Where="CustomerID == @CustomerID"> |
| <WhereParameters> |
| <asp:ControlParameter ControlID="RadGrid1" Name="CustomerID" |
| PropertyName="SelectedValues['CustomerID']" |
| Type="String" /> |
| </WhereParameters> |
| </asp:LinqDataSource> |
| Protected Sub RadGrid1_InsertCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.InsertCommand |
| If "Detail".Equals(e.Item.OwnerTableView.Name) Then |
| Dim parentItem As Telerik.Web.UI.GridDataItem = DirectCast(e.Item.OwnerTableView.ParentItem, Telerik.Web.UI.GridDataItem) |
| LinqDataSource2.InsertParameters("CustomerID").DefaultValue = parentItem.OwnerTableView.DataKeyValues(parentItem.ItemIndex)("CustomerID").ToString |
| End If |
| End Sub |
| <InsertParameters> |
| <asp:ControlParameter ControlID="RadGrid1" Name="CustomerID" |
| PropertyName="SelectedValues['CustomerID']" Type="String" /> |
| </InsertParameters> |
| <ClientSettings> |
| <ClientEvents OnCommand="RaiseCommand" /> |
| </ClientSettings> |
| function RaiseCommand(sender, args) { |
| var cmd = args.get_commandName(); |
| if (cmd = 'InitInsert') { |
| var message = "Add new clicked.\n" + |
| "Click OK to continue or Cancel to change your selection.\n"; |
| if (!confirm(message)) |
| return args.set_cancel(true) |
| else |
| return args.set_cancel(false); |
| } |
| } |
Update ---
figured it out.
Slap this into the DeleteCommand...
Dim ID As String = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)
("Your Data Key Name").ToString()
---End Update
well it is face slap wednesday and I am confused.
all i want to do is have 2 columns. cancel (link button) and select (link button)
I can trap the selected value (datakeyname) using the selectedindex.. but cannot for the life of me see how to get it when i use the cancel command. I can return 'cancelled' in the msglabel... however I cannot get the value of the row that I need to work with.
source
| <telerik:RadGrid ID="RadGrid1" width="200px" runat="server" GridLines="None"> |
| <MasterTableView DataKeyNames="Pos_id"> |
| <Columns> |
| <telerik:GridButtonColumn CommandName="Delete" ButtonType="LinkButton" Text="Cancel" UniqueName="CancelCol" /> |
| <telerik:GridButtonColumn CommandName="Select" DataTextField="ListName" UniqueName="column1" /> |
| </Columns> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| </MasterTableView> |
| <ClientSettings> |
| <Selecting AllowRowSelect="True" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
Code:
| Protected Sub RadGrid1_DeleteCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadGrid1.DeleteCommand |
| Try |
| 'Run a SQLNonQry to update data |
| 'repopulate |
| msglabel.Text = RadGrid1.SelectedValue & " Cancelled " |
| populateGrid() |
| Catch ex As Exception |
| msglabel.Text = ex.Message |
| End Try |
| End Sub |
| Protected Sub RadGrid1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.SelectedIndexChanged |
| 'update related ascx form |
| Ctrls_frm_CreatePosting.posid = RadGrid1.SelectedValue |
| msglabel.Text = RadGrid1.SelectedValue & " Selected" |
| End Sub |
| sub PopulateGrid() |
| 'basic grid populate with sql ds |
| end sub |