Telerik Forums
UI for ASP.NET AJAX Forum
8 answers
155 views
We have a very strange problem, we have a RadGrid that is invisible inside an UpdatePanel, that is set as the receiver of AJAX requests (along with other control). When the sender initiates an AJAX request, the RadGrid will try to DataBind, even though it is still invisible, which seem strange. Is this really expected behaviour or is it a bug? In my world, and invisible RadGrid should never try to DataBind by itself (all data operations for the grid is handled automatically).
Martin
Telerik team
 answered on 26 Apr 2011
1 answer
75 views
hi

This is my code:

<ResourceTypes>
                     <telerik:ResourceType DataSourceID="sdsUsers" ForeignKeyField="UserID"
                         KeyField="UserID" Name="User_Name" TextField="User_Name" />
</ResourceTypes>

    Protected Sub RadScheduler1_AppointmentDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.SchedulerEventArgs) Handles RadScheduler1.AppointmentDataBound
        If e.Appointment.Resources.GetResourceByType("User_Name") IsNot Nothing Then
            e.Appointment.BackColor = DataBinder.Eval(e.Appointment.Resources.GetResourceByType("User_Name").DataItem, "BackColor")
        End If
    End Sub

My user table schema:

UserID
User_Name
BackColor

I still do not get any color for the scheduler. What went wrong with my setting?

Veronica
Telerik team
 answered on 26 Apr 2011
1 answer
75 views
How can I make the cover flow items clickable? The demo doesn't do this.

Thanks!
Niko
Telerik team
 answered on 26 Apr 2011
8 answers
901 views
Hi,

I am working on a scenario where Feeds are downloaded from a web URL. Since this feed downloading can be a time taking process, I want to shift this logic and grid databinding to Async mode.
I did checked different threads talking about NeedDatasource to other approaches but none of them is working for me. Given below is code for your reference:

//WebUserControl1.ascx

<%

 

@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl1.ascx.cs" Inherits="WebUserControl1" %>

 

 

<%

 

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

 

 

 

<

 

 

telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

 

<

 

 

script language="javascript" type="text/javascript">

 

 

 

function OnRowClicked(sender, eventArgs) {

 

 

 

 

var newsDetailURL = eventArgs.getDataKeyValue("link") + '&style=html';

 

 

 

 

var index = newsDetailURL.indexOf('http://');

 

 

 

 

if (index == -1) {

 

 

newsDetailURL = newsDetailURL.replace(

 

'http:/', 'http://');

 

 

}

 

window.open(newsDetailURL,

 

'', 'location=0,status=0,toolbar=0,directories=no,menubar=no,titlebar=no,scrollbars=1,resizable=1');

 

 

}

 

 

 

function RebindNewsFeeds() {

 

 

 

 

var btnRebind = $get('<%= btnReload.ClientID %>');

 

 

btnRebind.click();

 

}

 

 

 

function ResizeNewsFeed() {

 

 

 

 

// var grid = document.getElementById("<%= RadGridNewsFeed.ClientID %>"); //$find("< % = .ClientID % >");

 

 

 

// var parentDiv = grid.parentNode;

 

 

 

// var documentObj = document.documentElement;

 

 

 

// if (window.opera || (document.all && !(document.compatMode && document.compatMode == "CSS1Compat"))) {

 

 

 

// documentObj = document.body;

 

 

 

// }

 

 

 

// parentDiv.height = '100%';

 

 

 

// parentDiv.width = '100%';

 

 

 

// parentDiv.style.height = '100%';

 

 

 

// parentDiv.style.width = '100%';

 

 

 

try {

 

 

 

 

var grid = $find("<%= RadGridNewsFeed.ClientID %>");

 

 

grid._scrolling._initializeDimensions();

 

 

 

//grid.repaint();

 

}

 

catch (ex) { }

 

 

}

</

 

 

script>

 

 

</

 

 

telerik:RadCodeBlock>

 

 

<

 

 

telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default">

 

 

 

</telerik:RadAjaxLoadingPanel>

 

 

<

 

 

telerik:RadAjaxPanel ID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" runat="server" Height="100%" Width="100%">

 

 

 

 

<telerik:RadGrid ID="RadGridNewsFeed" runat="server"

 

 

 

 

AutoGenerateColumns="False" OnItemDataBound="RadGridNewsFeed_ItemDataBound"

 

 

 

Skin="Grid" EnableEmbeddedSkins="False" GridLines="None"

 

 

 

 

HeaderStyle-Width="100%" ItemStyle-Width="100%" width="100%"

 

 

 

 

Height="100%" AllowSorting="True" ItemStyle-Wrap="false"

 

 

 

style="margin:0; border: 0; outline: none"

 

 

 

 

EnableViewState="False" onneeddatasource="RadGridNewsFeed_NeedDataSource" >

 

 

 

 

<MasterTableView Width="100%" CellPadding="0" CellSpacing="0"

 

 

 

 

ClientDataKeyNames="link" ShowHeadersWhenNoRecords="true"

 

 

 

 

AllowNaturalSort="false" TableLayout="Auto" EnableViewState="False">

 

 

 

 

<SortExpressions>

 

 

 

<telerik:GridSortExpression FieldName="pubDate" SortOrder="Descending" />

 

 

 

</SortExpressions>

 

 

 

 

<CommandItemSettings ExportToPdfText="Export to Pdf" />

 

 

 

<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">

 

 

 

</RowIndicatorColumn>

 

 

 

<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">

 

 

 

</ExpandCollapseColumn>

 

 

 

<Columns>

 

 

 

<telerik:GridBoundColumn DataField="pubDate" HeaderText="Date" UniqueName="pubDate">

 

 

 

<HeaderStyle HorizontalAlign="Left" Width="20%" />

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="Title" HeaderText="Title" UniqueName="Title" HeaderStyle-Width="80%">

 

 

 

<HeaderStyle HorizontalAlign="Left"/>

 

 

 

<ItemStyle Wrap="false" />

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn DataField="link" HeaderText="Detail News Link" UniqueName="link" Visible="false">

 

 

 

<HeaderStyle HorizontalAlign="Left" />

 

 

 

 

</telerik:GridBoundColumn>

 

 

 

</Columns>

 

 

 

 

<EditFormSettings>

 

 

 

<EditColumn CancelImageUrl="Cancel.gif" EditImageUrl="Edit.gif"

 

 

 

 

FilterControlAltText="Filter EditCommandColumn column"

 

 

 

 

InsertImageUrl="Update.gif" UpdateImageUrl="Update.gif">

 

 

 

</EditColumn>

 

 

 

</EditFormSettings>

 

 

 

</MasterTableView>

 

 

 

 

<SortingSettings EnableSkinSortStyles="false" />

 

 

 

 

<ClientSettings EnableRowHoverStyle="true" >

 

 

 

<ClientEvents OnRowClick="OnRowClicked" />

 

 

<%

 

--<Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" ScrollHeight="100%"/>--%>

 

 

 

 

</ClientSettings>

 

 

 

 

<HeaderStyle Width="100%" />

 

 

 

<ItemStyle Width="100%" Wrap="False" />

 

 

 

<FilterMenu EnableEmbeddedSkins="False" EnableImageSprites="False">

 

 

 

</FilterMenu>

 

 

 

<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Grid"

 

 

 

 

EnableEmbeddedSkins="False">

 

 

 

</HeaderContextMenu>

 

 

 

</telerik:RadGrid>

 

 

<

 

 

asp:Button ID="btnReload" SkinID="ButtonHidden" runat="server" OnClick="btnReload_Click"

 

 

 

Text="Button" />

 

 

 

 

<input type="hidden" id="txtLastUrl" runat="server" value ="" />

 

</

 

 

telerik:RadAjaxPanel>

 

 

//Code WebUserControl1.ascx.cs

using

 

 

System;

 

using

 

 

System.Collections.Generic;

 

using

 

 

System.Linq;

 

using

 

 

System.Web;

 

using

 

 

System.Web.UI;

 

using

 

 

System.Web.UI.WebControls;

 

using

 

 

Telerik.Web.UI;

 

using

 

 

System.Data;

 

using

 

 

System.Net;

 

public

 

 

partial class WebUserControl1 : System.Web.UI.UserControl

 

{

 

 

DataSet _dsNewsFeed = null;

 

 

 

 

const string styleTag = "&style=html";

 

 

 

 

private delegate void DownloadNewsFeedData(string val);

 

#region

 

 

Cotrol Events

 

 

 

 

/// <summary>

 

 

 

/// It will be called whenver master form is laoded or refreshed

 

 

 

/// </summary>

 

 

 

/// <param name="sender">Caller of the event</param>

 

 

 

/// <param name="e">Event info which is passed along the method</param>

 

 

 

protected void Page_Load(object sender, EventArgs e)

 

 

{

 

 

 

if (!IsPostBack)

 

 

LoadNewsFeed();

 

}

#endregion

#region

 

 

Public Routines

 

 

 

 

/// <summary>

 

 

 

/// It will be called whenever you want to hit the third party server to download the feed for the active company

 

 

 

/// </summary>

 

 

 

public void LoadNewsFeed()

 

 

{

 

 

 

try

 

{

 

 

 

//Formulate the url to get the news for the company

 

 

 

string newsFeedURL = "http://savanet.acquiremedia.com/news/search";

 

 

 

 

string companyNewsFeedURL = "http://savanet.acquiremedia.com/news/search?query=/ANN";

 

 

_dsNewsFeed =

 

new DataSet();

 

 

 

 

//GetNewsFeedDataTable(companyNewsFeedURL);

 

 

 

////Call async thread to download news feed data

 

 

 

DownloadNewsFeedData downloadNewsFeedData = new DownloadNewsFeedData(GetNewsFeedDataTable);

 

 

 

 

AsyncCallback ac = new AsyncCallback(UpdateNewsFeedDownloadingStatus);

 

 

downloadNewsFeedData.BeginInvoke(companyNewsFeedURL, ac, downloadNewsFeedData);

 

 

 

 

 

}

 

 

 

catch (Exception ex)

 

 

{

 

 

 

}

 

}

#endregion

#region

 

 

Private Routines

 

 

 

 

/// <summary>

 

 

 

/// It will be called when news downloading thread is completed

 

 

 

/// </summary>

 

 

 

/// <param name="ar">Result object of the async thread</param>

 

 

 

private void UpdateNewsFeedDownloadingStatus(IAsyncResult ar)

 

 

{

 

 

 

try

 

{

 

 

//Bind news feed data table to the grid

 

RadGridNewsFeed.DataSource = _dsNewsFeed.Tables[

 

"item"];

 

 

RadGridNewsFeed.DataBind();

 

 

 

//Terminate exchange rate downloading request

 

 

 

DownloadNewsFeedData downloadNewsFeedData = (DownloadNewsFeedData)ar.AsyncState;

 

 

 

 

if (!object.Equals(null, downloadNewsFeedData))

 

 

downloadNewsFeedData.EndInvoke(ar);

 

 

 

}

 

 

 

catch (Exception ex) { }

 

 

}

 

 

 

/// <summary>

 

 

 

/// It will download the feed from third party server and bind it to the grid

 

 

 

/// </summary>

 

 

 

/// <param name="newsFeedURL">Third party web service url to download the feed</param>

 

 

 

private void GetNewsFeedDataTable(string newsFeedURL)

 

 

{

 

 

 

 

 

if (txtLastUrl.Value != newsFeedURL)

 

 

{

 

txtLastUrl.Value = newsFeedURL;

 

 

 

// Create the web request

 

 

 

HttpWebRequest request = WebRequest.Create(newsFeedURL) as HttpWebRequest;

 

 

request.Timeout = 10000;

 

 

 

// Get response

 

 

 

using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)

 

 

{

 

 

 

 

 

// Load data into a dataset

 

_dsNewsFeed.ReadXml(response.GetResponseStream());

 

 

//LogUtility.BuildNewExceptionAndLog(this.GetType(), "GetNewsFeedDataTable", "After get response" + _dsNewsFeed.Tables["item"].Rows.Count.ToString());

 

}

 

 

//RadGridNewsFeed.DataSource = _dsNewsFeed.Tables["item"];

 

 

 

//RadGridNewsFeed.DataBind();

 

}

}

#endregion

#region

 

 

Grid Events

 

 

 

 

/// <summary>

 

 

 

/// It is called after an item is bound to the grid

 

 

 

/// </summary>

 

 

 

/// <param name="sender">The caller of the method. In this case it will be grid</param>

 

 

 

/// <param name="e">It contains the parameter information which is passed along the event</param>

 

 

 

protected void RadGridNewsFeed_ItemDataBound(object sender, GridItemEventArgs e)

 

 

{

 

 

 

if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)

 

 

{

 

 

 

GridDataItem gItem = (GridDataItem)e.Item;

 

 

 

 

DataRowView dr = e.Item.DataItem as DataRowView;

 

 

 

 

if (dr.Row["description"] != DBNull.Value || !string.IsNullOrEmpty(dr.Row["description"].ToString()))

 

 

{

 

gItem.ToolTip = dr.Row[

 

"description"].ToString();

 

 

}

 

}

 

}

#endregion

 

 

protected void btnReload_Click(object sender, EventArgs e)

 

 

{

 

 

 

this.LoadNewsFeed();

 

 

}

 

 

 

protected void RadGridNewsFeed_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)

 

 

{

 

 

 

try

 

{

 

 

////Bind news feed data table to the grid

 

 

 

//if (_dsNewsFeed != null && _dsNewsFeed.Tables.Count > 0)

 

 

 

// RadGridNewsFeed.DataSource = _dsNewsFeed.Tables["item"];

 

 

 

//else

 

 

 

// RadGridNewsFeed.DataSource = null;

 

}

 

 

catch (Exception ex) { }

 

 

}

 

}


I tried attaching code but it is not allowed :(
Thanks in anticipation.
Asim
Top achievements
Rank 1
 answered on 26 Apr 2011
3 answers
165 views
Hello,

  I am on Q2 2010 SP2. I have a rad panel declared like this.

<telerik:RadPanelBar runat="server" ID="RadPanelBar1" Width="100%" Visible="true" EnableViewState="true">
  <Items>
    <telerik:RadPanelItem Expanded="true" Text="Transfer1" runat="server" Selected="true" PreventCollapse="true" style="font-size:10pt;font-weight:bold">
      <Items>
        <telerik:RadPanelItem Value="Transfer2" runat="server" Width="100%">
         <ItemTemplate>
          <div style="background-color: #edf9fe">      
            <table width="100%">
                <tr><td width="15%"><b>Order Number : </b></td><td align="left" width="40%"><b><asp:Label ID="lblOrderNumber" runat="server" Text='<%#Bind("OrderNumber")%>'></asp:Label></b></td><td>Customer ID:</td><td align="left"><asp:Label ID="lblCustomerID" runat="server" Text='<%# Bind("CustomerID")%>'></asp:Label></td></tr>               
            </table>
    </div>
   </ItemTemplate>
  </telerik:RadPanelItem>
 </Items>
</telerik:RadPanelItem>
        </Items>
 </telerik:RadPanelBar>  


Is it possible to Bind the "Transfer2" RadPanelItem to a Datatable  and have the ORderNumber and CustomerID fields set from the first row in the Datatable?

Thanks,
Kavitha
Shinu
Top achievements
Rank 2
 answered on 26 Apr 2011
3 answers
532 views

Hello Everyone,
I am binding the Grid inside a loadHeader method and inside that method, I need to call an event called raIseChangedEvent. Inside raiseChangedEvenet, I need to find the label control inside the gridview and get the value of it. I am not sure how to do this. I did this long time ago  using asp grid, but here with radGrid, I don't know how to do this. below is my code

public loadHeader()
{

    RadGrid_Header.DataSource = HeaderList;
         RadGrid_Header.DataBind();
         RaiseChangedEvent();

}

 

    protected void RaiseChangedEvent()
    {
       // This is what i did with asp.net gridview
         grd_view_tracking.SelectedIndex = 0;
        GridViewRow selected_row = grd_view_tracking.SelectedRow;
        string job_seq_text_val = ((Label)selected_row.FindControl("lbl_job_seq")).Text;

      

    }

How can I get the value of job_seq_text_val  in RadGrid.

Any help will be greatly appreciated

Princy
Top achievements
Rank 2
 answered on 26 Apr 2011
1 answer
47 views
Hi,

A quick question (I hope) - is there a limit to the number of levels in a hierarchical RadGrid?

Thank you,
Donna
Princy
Top achievements
Rank 2
 answered on 26 Apr 2011
3 answers
305 views
Hi,

How do I modify the ListBox to allow the user to select / deselect (toggle) each item simply by clicking it, i.e. without pressing CTRL?

Thanks,

Rob
Tim Harker
Top achievements
Rank 2
 answered on 25 Apr 2011
1 answer
41 views
hi,
scenario is like this,
i have a radgrid  is populated successfully. on this grid a button is put.
when this button is clicked a radwindow is displayed. In this radwindow a grid is put and this radgrid fetch the record from database.
this child radgrid that is put in Radwindow when populated with 2000 records from the database using ORM, takes almost 10 min.
is there any way so that data can be populated in this grid in fast manner.


Thanks to all.
Daniel
Telerik team
 answered on 25 Apr 2011
4 answers
272 views

Hi
I Have the following DataSet structure:

Price__MakeID__SourceID__Day
100______1________1_______1 
101______1________1_______2 
101______1________1_______3 
101______1________1_______4 
101______1________1_______5 
101______1________1_______6 
102______1________1_______7 
102______1________1_______8 
102______1________1_______9 
100______1________2_______1 
102______1________2_______2 
102______1________2_______3 
102______1________2_______4 
103______1________2_______5 
103______1________2_______6 
102______1________2_______7 
101______1________2_______8 
100______1________2_______9 

100______2________1_______1 
101______2________1_______2 
101______2________1_______3 
101______2________1_______4 
101______2________1_______5 
101______2________1_______6 
102______2________1_______7 
102______2________1_______8 
102______2________1_______9 
100______2________2_______1 
102______2________2_______2 
102______2________2_______3 
102______2________2_______4 
103______2________2_______5 
103______2________2_______6 
102______2________2_______7 
101______2________2_______8 
100______2________2_______9 

Basically I am tracking the price of products from a number of sources over a number of days.

How would I bind this dataset to a Line Grid so that the y axis shows the price, the x axis shows the Day and lines on the grid show the variation in price by make (different color line for each source)

Any pointers would be great!

Thanks

Evgenia
Telerik team
 answered on 25 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?