Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
280 views
Hello

I am having problems trying to display the message (or a custom message) "No records to diplay" in the radgrid when my page first loads.

I have tried putting in this code on the page load event:

 

If Not IsPostBack Then

 

rgListingWithImages.DataSource =

New Object() {}

 

 

'rgListingWithImages.Rebind()

 

 

End If

 

 
but I get this error.
Both DataSource and DataSourceID are defined on 'rgListingWithImages'.  Remove one definition.

Here is my radgrid code:
***************************************************************************************************************************************************************

<

 

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

 

Chom
Top achievements
Rank 1
 answered on 22 Feb 2010
2 answers
210 views
I am developing an internal web application and when I upload an image using RadEditor Imageupload, it successfully gets uploaded to a virtual directory in the web application. The application creates a document and it can be viewed by anyone outside the network.

So when I insert the images, it reference the virtual directory which is only accessible internally.
So when people outside the network views the document, they are unable to see the images in the document since the image reference is set to the virtual folder.

I can copy the images in the virtual folder to a folder that is accessible from www. In that case how can I change the image reference to point to the external image.

for example.
Image upload folder in only Internal
~/images/a.jpg

I can copy this a.jpg to another server which is available externally.
Say I copy access the image using
www.test.org/images/a.jpg

How can I change the image reference from ~/images/a.jpg to www.test.org/images/a.jpg/

please let me know.
thanks

nickJr
Top achievements
Rank 1
 answered on 22 Feb 2010
4 answers
135 views

Hello,

I start with Telerik, and i woul'd like to put Telerik controls into webcontrol.
i have try many solution, but no one display me the result in the design mode.
I have an error : "Error Creating Control " "Object reference not set to an instance of an object."
but when I run the webpage, i see my Telerik control.

do you have an idea for this problems ?

my code :
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 
 
 

thanks a lot !!!
Daniel
Telerik team
 answered on 22 Feb 2010
1 answer
83 views
Hi,

I want to set styles to Paragaraph, I am able to set the styles but after setting style the selected paragraphs are becoming bold. Editor is adding <Strong> tag to the selected Paragraphs. Please tell me any work around for this, or is it issue in Editor when we do PasteHtml with P tags. This happens for P tags

My Code is as below:

var cssTextFormed = "text-align:"+textAlign+";line-height:"+lineSpace+";text-indent:"+hanging+"; margin: "+ beforePara+ " "+ rightindents +" "+ afterPara +" "+ leftindents +";";
   
var editor =$find("RadEditor1");
   
//if more than one paragrah is selected then replace p tag with applied style
var selection = editor.getSelectionHtml().replace(/<P/g,'<P style='+cssTextFormed);
editor.pasteHtml(selection);
Rumen
Telerik team
 answered on 22 Feb 2010
1 answer
118 views
So I was doing the tutorials when I needed to reset my computer... afterwards I cannot get the controls to work on a page.  THe attached screenshot is all I get any help please?  I had to readd the controls manually to the toolbox and I tried reinstalling as well...  any help?
Schlurk
Top achievements
Rank 2
 answered on 22 Feb 2010
1 answer
99 views
Hello,
I was studying on Asp.net ajax controls (Telerik one) and I was looking if the gridview supports drag and drop...any example to link?
Thanks

Paolo
Schlurk
Top achievements
Rank 2
 answered on 22 Feb 2010
1 answer
127 views
Hi all

I have a dilemma with a rad window. Here is an example.

I have grid and some buttons on a page. I am opening the radwindow from a link button in the grid using the ItemCommand event in code behind.

Here is the code where I open the radwindow:

 

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?

 

Georgi Tunev
Telerik team
 answered on 22 Feb 2010
1 answer
177 views
Hello

Google indexes my pages with LOCK tags as a description. Here's the result:

www.esse.com.tr

##LOC[OK]## ##LOC[Cancel]##. Esse. Pazar, Şubat 14 | Son Gezdiklerim | Üye girişi | Hesap oluştur | Sepetim | Sipariş Takibi

How can I fix that?



Georgi Tunev
Telerik team
 answered on 22 Feb 2010
10 answers
302 views
Hello all,
How can I convert the Telerik Image Manager to be Database Driven control?

Thanks,
Amr Saafan
Senior Software Developer
http://amrsaafan.blogspot.com
Yvonne Patakidou
Top achievements
Rank 1
 answered on 22 Feb 2010
1 answer
163 views
Hi there

I don't think, this is telerik-specific but perhaps you can help me anyway.

I got a Form embedded into a RadAjaxPanel containg some "dumb" TextBoxes and a combobox which initiates a postback:

 <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" /> 
 (I removed Table-/TR/TD and other stuff)

When selecting the Combobox a postback is initiated (as expected and wanted). But before this happens I can still enter some stuff into the textboxes. But these are emptied when the Postback finally takes place.

Any idea how to solve that issue or at least disable the comboboxes for that period of time?
robertw102
Top achievements
Rank 1
 answered on 22 Feb 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?