Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
208 views
Hi
I'm trying to extract information from a dbase into the rotator. This is the code i have so far:

Imports System
Imports System.Data
Imports System.Data.OleDb
Imports System.Drawing
Imports Telerik.Web.UI
Imports System.Collections.Generic
Partial Class fullview
    Inherits System.Web.UI.Page
    Private Structure fileInfo
        Public Url As String
        Public Image As String
          End Structure

    Private Property imagesArray() As List(Of fileInfo)
        Get
            Return DirectCast(ViewState("imagesArray"), List(Of fileInfo))
        End Get
        Set(ByVal value As List(Of fileInfo))
            ViewState("imagesArray") = value
        End Set
    End Property
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim rotatorData As New DataTable()
        rotatorData.Columns.Add("URL")
        rotatorData.Columns.Add("Image")
        Dim conn As Data.SqlClient.SqlConnection
        Dim cmd As Data.SqlClient.SqlCommand
        Dim reader As Data.SqlClient.SqlDataReader
        conn = New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings.Item(1).ToString)

        Dim gal, photo, urli As String
        urli = Request.QueryString("galleryName")
        'temp = urli.Substring(urli.IndexOf("=") + 1, (urli.IndexOf("&")) - (urli.IndexOf("=") + 1))
        gal = urli.Replace("%20", " ")
        urli = Request.QueryString("photo")
        photo = urli.Replace("%20", " ")
        Response.Write(urli & gal & photo)
        conn.Open()
        cmd = New Data.SqlClient.SqlCommand("select * from Gallery where GalleryName='" & gal & "' and UserID=" & Session("uid"), conn)
        imagesArray = New List(Of fileInfo)()

        reader = cmd.ExecuteReader

        If (reader.HasRows) Then

            While (reader.Read())

                Dim fInfo As New fileInfo()
                fInfo.Url = "<a href=" & Chr(34) & "javascript:ajaxpage('fullview.aspx?galleryname=" & gal & "&photo=" & Trim(reader("PictureURL").ToString) & "','contentarea')" & Chr(34) & ">"
                fInfo.Image = "'images/users/" & Session("uid") & "/" & gal & "/Thumbnails/" & Trim(reader("PictureURL").ToString) & "'"

                imagesArray.Add(fInfo)
            End While
      
        End If
        RebindRotator()

    End Sub
    Private Sub RebindRotator()
        Dim rotatorData As New DataTable()
        rotatorData.Columns.Add("Url")
        rotatorData.Columns.Add("Image")
        For Each tempInfo As fileInfo In imagesArray
            rotatorData.Rows.Add(New String() {tempInfo.Url, tempInfo.Image})
        Next

        RadRotator1.DataSource = rotatorData()
        RadRotator1.DataBind()
    End Sub

End Class

and the aspx:

 <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
        OutputCompression="AutoDetect">
    </telerik:RadScriptManager>
  
        <telerik:RadRotator ID="RadRotator1" runat="server">
         <ItemTemplate>
      <a href="<%# DataBinder.Eval(Container.DataItem, "URL") %>"><img src="<%# DataBinder.Eval(Container.DataItem, "Image") %>"</a>
   </ItemTemplate>
        </telerik:RadRotator>
        <br />

The error i get is:

Server Error in '/profiles' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30367: Class 'System.Data.DataTable' cannot be indexed because it has no default property.

Source Error:


Line 65:         Next
Line 66:
Line 67: RadRotator1.DataSource = rotatorData()
Line 68: RadRotator1.DataBind()
Line 69: End Sub

I was hoping that since i gleaned this tactic from one of your examples, you might be able to help me with that, since i'm not having much luck on the net.
Thanks in advance.
Georgi Tunev
Telerik team
 answered on 15 Sep 2008
0 answers
129 views
When querying the rotator for the current item outside a clientside event handler the get_currentItem() returns the DOM element instead of a RadRotatorItem object.

var rotator = <%# radRotator1.ClientID %>.control;
var currentItem = rotator.get_currentItem();

This only gets a reference to the current listitem (LI)

var currentItem = rotator.get_currentItem().control;
var currentItem = rotator.get_currentItem()._item;

These do get references to the RadRotatorItem object
J-P Minderhoud
Top achievements
Rank 1
 asked on 15 Sep 2008
1 answer
135 views
I have a ComboBox with a template defined at design-time.  The control is bound to a SqlDataSource, also defined at design-time.  What I want to do is insert an item after the control is bound to the datasource (so, in the OnDataBound event).

I can insert a new item, but this new item doesn't contain any of the additional fields/values that the databound items have.  I thought I could add the fields as attributes, but that didn't work.  I'm sure this must be possible, but cannot figure it out or find the solution... what's the trick?
Yana
Telerik team
 answered on 15 Sep 2008
1 answer
263 views
Hi,
 
                I  created grid dynamically and paced button on page.It is working fine except column width when i browse the page first time.
                I am also  displaying seach conditions in RadWindow when user clicks on button.

Note : I created xml file for columns definations and using to generate the bound columns.

Can you please help me to resolve the below issues?

Issues List :
               1. I am getting extra columns when i click on pager to selct particular page or  column for sort.
               2. I want to sort the records within the page not on data source, Is there any way we can sort the records present in the page?
              3. How can we set the column width in RadGrid?
              4. I am getting the popup with retry and cancel buttons with the below message when i seach the records other than first page or before selecting the column sort or paging. Can you please advice me on this?
  
To Display the webpage again, Internet Explorer needs to resend the information you've previously submited

If you were making a purchase, you should click Cancel to avoid a duplicate transaction. Otherwise, click Retry to display the webpage again.


HTML :

<%

@ Page Language="C#" MasterPageFile="~/DealerFinance.master" AutoEventWireup="true" CodeFile="DealerList.aspx.cs" Inherits="Dealer_DealerList" Title="Untitled Page" %>

<%

@ MasterType VirtualPath="~/DealerFinance.master" %>

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<

asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

</

asp:Content>

<

asp:Content ID="Content2" ContentPlaceHolderID="DealerFinancePlaceHolder" Runat="Server">

<table>

<tr>

<td align="left">

<asp:Button ID="btnSearch" runat="server" CausesValidation="false" SkinID="DisplayButton"

Text="Search" />

&nbsp;

</td>

</tr>

<tr>

<td>

<telerik:RadGrid ID="grdDealerList" runat="server" >

</telerik:RadGrid>

<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>

</td>

</tr>

</table>

<telerik:radwindow openerelementid="<%# btnSearch.ClientID %>" navigateurl="DealersSearch.aspx"

runat="server" width="400px" height="350px" id="Radwindow4" visiblestatusbar="false"

skin="Mac"></telerik:radwindow>

</

asp:Content>

ASPX :

using

System;

using

System.Collections;

using

System.Configuration;

using

System.Data;

using

System.Linq;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

System.Web.UI.HtmlControls;

using

System.Web.UI.WebControls;

using

System.Web.UI.WebControls.WebParts;

using

System.Xml.Linq;

using

Telerik.Web.UI;

using

System.Data.SqlClient;

using

System.Xml;

public

partial class Dealer_DealerList : System.Web.UI.Page

{

public string searchCondition = "";

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

Master.SelectedDealerTab = 1;

DealSearchFields dealerSeachFieldsObj = (DealSearchFields)Session["DealerSearchFields"];

if (dealerSeachFieldsObj != null)

{

searchCondition = dealerSeachFieldsObj.DealerNumber;

}

else

{

searchCondition =

"";

}

}

 

}

protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)

{

grdDealerList.DataSource = BindGrid();

}

private DataTable BindGrid()

{

string sql = "SELECT ROW_ID ,DEALER_NUM ,NAME, LEGAL_NAME, SALES_DISTRICT, BUSINESS_TYPE FROM KF_DEALER where DEALER_NUM LIKE '%" + searchCondition + "%' order by DEALER_NUM";

SqlDataAdapter adapter = new SqlDataAdapter(sql,

ConfigurationManager.ConnectionStrings["KC_DealerFinanceConnectionString"].ConnectionString);

DataTable dt = new DataTable();

adapter.Fill(dt);

return dt;

}

protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)

{

if (e.CommandName == "Select")

{

GridDataItem dataItem = (GridDataItem)e.Item;

string strTxt = dataItem.GetDataKeyValue("DEALER_NUM").ToString();

string rowID = dataItem.GetDataKeyValue("ROW_ID").ToString();

Response.Redirect(

"DealerDetails.aspx");

}

 

 

}

protected void Page_Init(object sender, System.EventArgs e)

{

DefineGridStructure();

}

 

private void DefineGridStructure()

{

//RadGrid grdDealerList = new RadGrid();

//grdDealerList.ID = "RadGrid1";

grdDealerList.NeedDataSource +=

new GridNeedDataSourceEventHandler(this.RadGrid1_NeedDataSource);

grdDealerList.ItemCommand +=

new GridCommandEventHandler(this.RadGrid1_ItemCommand);

//grdDealerList.DataSource = BindGrid();

grdDealerList.Skin =

"Inox";

//grdDealerList.Width = Unit.Percentage(100);

grdDealerList.PageSize = 5;

grdDealerList.AllowPaging =

true;

grdDealerList.PagerStyle.Mode =

GridPagerMode.NextPrevAndNumeric;

grdDealerList.AutoGenerateColumns =

false;

//grdDealerList.GroupingEnabled = true;

//grdDealerList.ShowGroupPanel = true;

grdDealerList.ShowStatusBar =

true;

grdDealerList.ClientSettings.AllowDragToGroup =

true;

grdDealerList.AllowSorting =

true;

grdDealerList.Width =

Unit.Percentage(100);

 

grdDealerList.MasterTableView.PageSize = 15;

grdDealerList.MasterTableView.DataKeyNames =

new string[] { "ROW_ID", "DEALER_NUM" };

GridButtonColumn selectColumn = new GridButtonColumn();

selectColumn.DataTextField =

"DEALER_NUM";

selectColumn.CommandArgument =

"DEALER_NUM";

selectColumn.CommandName =

"Select";

selectColumn.HeaderText =

"DealerNumber";

//selectColumn.

grdDealerList.MasterTableView.Columns.Add(selectColumn);

 

XmlDocument xmlDoc = new XmlDocument();

xmlDoc.Load(Request.MapPath(

"~/App_Data/DataMapping.xml"));

XmlNodeList columnNodeList = XML.GetNodeList("/DealerGrids/DealerGrid[@Name ='DealerList']/Columns/Column", xmlDoc);

 

foreach (XmlNode columnNode in columnNodeList)

{

string headerText = "";

headerText =

XML.GetAttributeValue("/Column", "DisplayText", columnNode.OuterXml);

if (headerText != null && headerText.Length > 0)

{

GridBoundColumn boundColumn = new GridBoundColumn();

boundColumn.DataField =

XML.GetAttributeValue("/Column", "TableColumnName", columnNode.OuterXml);

boundColumn.HeaderText = headerText;

grdDealerList.MasterTableView.Columns.Add(boundColumn);

}

}

this.PlaceHolder1.Controls.Add(grdDealerList);

}

}

XML :

<

DealerGrids>

<

DealerGrid Name="DealerList">

<

Columns>

<

Column TableColumnName="ROW_ID" DisplayText="" isDataKey="true" />

<

Column TableColumnName="DEALER_NUM" DisplayText="Dealer Number" isDataKey="true" />

<

Column TableColumnName="NAME" DisplayText="Dealer Name" isDataKey="true" />

<

Column TableColumnName="LEGAL_NAME" DisplayText="Legal Name" isDataKey="false" />

<

Column TableColumnName="SALES_DISTRICT" DisplayText="District" isDataKey="false" />

<

Column TableColumnName="BUSINESS_TYPE" DisplayText="Business Type" isDataKey="false" />

</

Columns>

</

DealerGrid>

</

DealerGrids>




             
Iana Tsolova
Telerik team
 answered on 15 Sep 2008
1 answer
95 views
hi to all,
i am using 2.8.4.0 version of rad combo box,
when i disabled the combo programatically it height and weight automatically increases.
waiting for a prompt reply from you.
Rosi
Telerik team
 answered on 15 Sep 2008
1 answer
97 views
I'm having a hard time trying to programatically add images to the panel bar.  I have read through formus for a few hours already.  This is pulled straight from an example.  Does not work for me.

<%

@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>


<telerik:RadPanelbar ID="RadPanelbar1" runat="server" Width="100%" Skin="Outlook" OnPanelItemDataBound="RadPanelbar1_OnPanelItemDataBound" ImagesBaseDir="~/img/" PersistStateInCookie="True">

</telerik:RadPanelbar>


Code behind

using

Telerik.Web.UI;


 

 //RadPanelbarPanelItemDataBoundEventArgs namespace can not be found!    I can't figure out why?
protected void RadPanelbar1_OnPanelItemDataBound(object sender,  RadPanelbarPanelItemDataBoundEventArgs e) 

{

if (!e.DataBoundDataRow.IsNull("Image"))

{

e.Item.ImageUrl = (

string)DataBinder.Eval(e.Item.DataItem, "image");

e.Item.ImageOverUrl = (

string)DataBinder.Eval(e.Item.DataItem, "image");

e.Item.ExpandedImageUrl = (

string)DataBinder.Eval(e.Item.DataItem, "image");

}

}




//Bind database to RadPanelBar.  This works

DataSet ds = new DataSet();

da.Fill(ds);

RadPanelbar1.DataSource = ds;

RadPanelbar1.DataFieldID =

"ID";

RadPanelbar1.DataFieldParentID =

"ParentID";

RadPanelbar1.DataTextField =

"Text";

RadPanelbar1.DataValueField =

"ID";

RadPanelbar1.DataNavigateUrlField =

"URL";

RadPanelbar1.DataBind();






Rosi
Telerik team
 answered on 15 Sep 2008
1 answer
130 views
Hello,

I have placed a pickerbutton inside a raddock, but when i click the button, the palette appear inside the dock causing it to show scrollbars (the dock is 200x200 px)

Is there a way to show the palette outside the dock?

Thank for the attention

Francesco
Sophy
Telerik team
 answered on 15 Sep 2008
3 answers
139 views
Hi,
       I have a scenario where i have a asp.net button which has a server click event. On click of that i will be parsing few folders and file structure and it will take bit time. Currenly my need is a way that which updates any of the asp.net control dynamically showing the user a status about the folder or file that is currently getting processed. To keep it simple assume there is a for loop which runs 2000 times and inside i print the counter value and this counter value has to be keep updated in a panel once the counter is incremented. something like this i require

processing ....1
processing ....2
processing ....3

..
..

processing ....2000

and finally it should exit. Currently the behaviour is once the click event returns it updates the value in my control visually. if i need the above requirement how to to do it using telerik ajax stuff. Please let me know if anything can help to satisfy my requirement.

Regards,
Elango

Sebastian
Telerik team
 answered on 15 Sep 2008
2 answers
114 views
I want to know is it's possible to changed the values of some textbox and dropdownlistbox fields when a select a value form an another dropdownlistbox in edit mode frorm a radgrid.

explanation: I have a grid containing a product number w(hich is a dropdownlistbox in edit mode), a description, mark, model unit_price (which they are textboxs) and Mesure_unit (which is a dropdownlistbox). 

If the client select a product number from the 1st dropdown i want to fill all the others fields with the value that i have in my database.

If the client don't select a product form de 1st dropdown they have to enter all the values for the others fields.

Is this possible

Thank you
Shinu
Top achievements
Rank 2
 answered on 15 Sep 2008
1 answer
109 views


Hi I am using rad treeview control which will have more than 500 nodes at any point of time. I am using Server Side as the expand mode as attributes are attached to the nodes. I am also using radajaxmanager to ajaxify the node expansion.

with IE 7 it takes almost 10-15 seconds to fully render the tree after expansion at the same time it takes hardly 3-4 seconds in safari.

I am using master page inmy application and various other rad controls like rad grid, rad splitter, rad pane and rad window.

I tried with UseEmbeddedScripts="false" but of no use.

Is radtree is not advisable with this many number of nodeds in container pages or IE?

The performance is very good in safari and poor in IE7.

Thanks
-Ankur

Paul
Telerik team
 answered on 15 Sep 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?