If Not IsPostBack Then
rgListingWithImages.DataSource =
New Object() {}
'rgListingWithImages.Rebind()
End If
<
telerik:RadGrid ID="rgListingWithImages" runat="server" GridLines="None" Skin="Office2007"
PageSize="8" ClientSettings-Scrolling-SaveScrollPosition="true" AllowPaging="True"
DataSourceID="dsBusinessListings">
<HeaderStyle HorizontalAlign="Left" />
<ItemStyle HorizontalAlign="Left" />
<AlternatingItemStyle HorizontalAlign="Left" />
<ClientSettings>
</ClientSettings>
<PagerStyle Mode="NumericPages" />
<MasterTableView PageSize="5" DataSourceID="dsBusinessListings" AutoGenerateColumns="False"
DataKeyNames="ID" CommandItemDisplay="Top" ShowHeadersWhenNoRecords="true" NoMasterRecordsText="Insert some records here">
<Columns>
<telerik:GridButtonColumn CommandName="DeleteRow" CommandArgument="DeleteRow" HeaderText=""
Text="Delete" UniqueName="DeleteRow">
</telerik:GridButtonColumn>
<telerik:GridBoundColumn DataField="ID" DefaultInsertValue="" HeaderText="ID" SortExpression="ID"
UniqueName="ID" DataType="System.Int32" ReadOnly="True" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CustomerID" DefaultInsertValue="" HeaderText="CustomerID"
SortExpression="CustomerID" UniqueName="CustomerID" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="OrderID" DefaultInsertValue="" HeaderText="OrderID"
SortExpression="OrderID" UniqueName="OrderID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="OrderDate" DataType="System.DateTime" DefaultInsertValue=""
HeaderText="OrderDate" SortExpression="OrderDate" UniqueName="OrderDate" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="BusinessListingNumber" DataType="System.Int32"
DefaultInsertValue="" HeaderText="BusinessListingNumber" SortExpression="BusinessListingNumber"
UniqueName="BusinessListingNumber">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="NumberOfImages" DataType="System.Int32" DefaultInsertValue=""
HeaderText="NumberOfImages" SortExpression="NumberOfImages" UniqueName="NumberOfImages">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="BusinessListingDescription" DefaultInsertValue=""
HeaderText="BusinessListingDescription" SortExpression="BusinessListingDescription"
UniqueName="BusinessListingDescription">
</telerik:GridBoundColumn>
</Columns>
<PagerStyle Mode="NextPrev" />
<CommandItemTemplate>
<asp:Button ID="btnInsertNewRecord" runat="server" CommandName="InsertNewRecord"
Text="New Record" Width="90px" Height="22px" />
</CommandItemTemplate>
</MasterTableView>
</telerik:RadGrid>
<asp:SqlDataSource ID="dsBusinessListings" runat="server" ConnectionString="<%$ ConnectionStrings:hbocdbConnectionString %>"
SelectCommand="admin_Customers_BusinessListing_SelectPrimaryInfo" SelectCommandType="StoredProcedure"
InsertCommand="admin_Customers_BusinessListing_InsertPrimaryInfo" InsertCommandType="StoredProcedure"
DeleteCommand="admin_Customers_BusinessListing_DeleteRowPrimaryInfo" DeleteCommandType="StoredProcedure">
<SelectParameters>
<asp:Parameter Name="CustomerID" Type="String" />
<asp:Parameter Name="OrderID" Type="String" />
<asp:Parameter Name="WithSlideNoSlide" Type="String" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="CustomerID" Type="String" />
<asp:Parameter Name="OrderID" Type="String" />
<asp:Parameter Name="TabStripSelectedIndex" Type="Int16" />
<asp:Parameter Name="BusinessListingDescription" Type="String" />
<asp:Parameter Name="WithSlideNoSlide" Type="String" />
</InsertParameters>
<DeleteParameters>
<asp:Parameter Name="CustomerID" Type="String" />
<asp:Parameter Name="OrderID" Type="String" />
<asp:Parameter Name="BusinessListingNumber" Type="Int16" />
<asp:Parameter Name="WithSlideNoSlide" Type="String" />
</DeleteParameters>
</asp:SqlDataSource>
<asp:Button ID="Button1" runat="server" Text="Button" />
***************************************************************************************************************************************************************
and my code behind to follow:
***************************************************************************************************************************************************************
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Temp for querystring params
'Set up the viewstate vars
Me.CustomerID = "BLC-7SUZE1SNNF-242010"
Me.OrderID = "OID-KWUV6-2212010"
Me.BusinessListingNumber = 1
Me.WithSlideNoSlide = "WS"
If Not IsPostBack Then
rgListingWithImages.DataSource =
New Object() {}
'rgListingWithImages.Rebind()
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
dsBusinessListings.SelectParameters(
"CustomerID").DefaultValue = "BLC-7SUZE1SNNF-242010"
dsBusinessListings.SelectParameters(
"OrderID").DefaultValue = "OID-KWUV6-2212010"
dsBusinessListings.SelectParameters(
"WithSlideNoSlide").DefaultValue = "WS"
End Sub
#Region
"RadGrid With Images Events."
Protected Sub rgListingWithImages_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgListingWithImages.ItemCommand
'Check which command name was selected
Select Case e.CommandName
Case "InsertNewRecord"
'Insert a new row into the BusinessListings table
dsBusinessListings.InsertParameters(
"CustomerID").DefaultValue = Me.CustomerID
dsBusinessListings.InsertParameters(
"OrderID").DefaultValue = Me.OrderID
dsBusinessListings.InsertParameters(
"TabStripSelectedIndex").DefaultValue = 0
dsBusinessListings.InsertParameters(
"BusinessListingDescription").DefaultValue = "Business Listing with slides."
dsBusinessListings.InsertParameters(
"WithSlideNoSlide").DefaultValue = "WS"
'Call the Insert method
dsBusinessListings.Insert()
'Refresh the grid data
SelectgridWithImages()
Exit Select
Case "DeleteRow"
'Delete the selected row from the BusinessListing table
Dim myItem As GridDataItem = DirectCast(e.Item, GridDataItem)
Dim CustID As TableCell = myItem("CustomerID")
Dim OrdID As TableCell = myItem("OrderID")
Dim ListNo As TableCell = myItem("BusinessListingNumber")
''Fill delete parameters
dsBusinessListings.DeleteParameters(
"CustomerID").DefaultValue = CustID.Text
dsBusinessListings.DeleteParameters(
"OrderID").DefaultValue = OrdID.Text
dsBusinessListings.DeleteParameters(
"BusinessListingNumber").DefaultValue = CType(ListNo.Text, Integer)
dsBusinessListings.DeleteParameters(
"WithSlideNoSlide").DefaultValue = "WS"
'Call delete method
dsBusinessListings.Delete()
'Refresh the grid data
SelectgridWithImages()
Exit Select
End Select
End Sub
Protected Sub rgListingWithImages_PageIndexChanged(ByVal source As Object, ByVal e As Telerik.Web.UI.GridPageChangedEventArgs) Handles rgListingWithImages.PageIndexChanged
SelectgridWithImages()
End Sub
Private Sub SelectgridWithImages()
'This is a basic select statement to fill the grid with data
dsBusinessListings.SelectParameters(
"CustomerID").DefaultValue = "BLC-7SUZE1SNNF-242010"
dsBusinessListings.SelectParameters(
"OrderID").DefaultValue = "OID-KWUV6-2212010"
dsBusinessListings.SelectParameters(
"WithSlideNoSlide").DefaultValue = "WS"
End Sub
#End
Region
***************************************************************************************************************************************************************
I have tried several things including the needdatasource but it still is not comming up.
Can someone point me in the right direction.
Thanks
| Public Class Class11 |
| Inherits System.Web.UI.WebControls.WebControl |
| Protected WithEvents RadComboBox2 As Global.Telerik.Web.UI.RadComboBox |
| Public Sub New() |
| MyBase.new() |
| RadComboBox2 = New Telerik.Web.UI.RadComboBox |
| RadComboBox2.ID = "toto" |
| End Sub |
| Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter) |
| RadComboBox2.RenderControl(output) |
| MyBase.CreateChildControls() |
| End Sub |
| Protected Overrides Sub CreateChildControls() |
| Me.Controls.Clear() |
| Me.Controls.Add(RadComboBox2) |
| End Sub |

Protected Sub rgListingWithImages_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgListingWithImages.ItemCommand
Dim value As String = Nothing
Select Case e.CommandName
Case ("DeleteRow")
'Do something here
Exit Select
Case ("Slides")
'Open the slide window
'RadWindowManager1.Windows(0).Visible = True
Dim newWindow As New RadWindow
newWindow.NavigateUrl =
"http://www.google.com"
newWindow.Top = Unit.Pixel(22)
newWindow.VisibleOnPageLoad =
True
newWindow.Left = Unit.Pixel(0)
RadWindowManager1.Windows.Add(newWindow)
Exit Select
End Select
End Sub
Here is the problem.
The window opens OK form the "Select" command of the grid. However when I click on the "Delete" command of the grid the window opens again and when I click on any other button on my page the radwindow opens.
Is there a way to open the window jsut from the "Select" event of hte grid?
| <telerik:RadAjaxPanel ID="FormPanel" runat="server" OnAjaxRequest="formPanel_AjaxRequest"> |
| <telerik:RadTextBox ID="txtUniqueName" runat="server" Width="240" /> |
| <telerik:RadNumericTextBox ID="txtILN" runat="server" Width="240" MaxLength="13" NumberFormat-GroupSeparator="" Type="Number" MinValue="0" NumberFormat-DecimalDigits="0" /> |
| <telerik:RadComboBox ID="cbxLanguage" runat="server" Width="240px" AutoPostBack="true" OnSelectedIndexChanged="cbxLanguage_SelectedIndexChanged" /> |