Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
111 views
may i know how to add clientside events on the fly using javascript?

a method that is similar to this:

var panel = $find("radPanelControl");
panel.addOnClientClickedEvent("CustomEvent");

thanks. hope to hearing from u soon.

 

 

 

 

 

 

 

 

mac-mac
Top achievements
Rank 1
 answered on 19 Aug 2009
1 answer
278 views
Hi

I am using a RadGrid control on my web page (search page) which allow user to filter columns. inside my RadGrid I have a link which redirects user to another page and user can back to the search page again.
I was wondering is there any way that I can store the RadGrid's filter condition in a place like session and restore all of them when user is back to visit the page.

I used the following code but it just returns the string ,it didn't set the filter column with their search value in RadGrid.

        protected void Page_Load(object sender, EventArgs e) 
        { 
            if (!IsPostBack) 
            { 
                if (Session["RadGridFilterConditions"] != null) 
                { 
                    RadGrid1.MasterTableView.FilterExpression = Session["RadGridFilterConditions"].ToString(); 
                    RadGrid1.DataBind(); 
                } 
            } 
        } 
        protected void Page_PreRender(object sender, EventArgs e) 
        { 
            Session["RadGridFilterConditions"] = RadGrid1.MasterTableView.FilterExpression; 
        } 

Thanks,
Shinu
Top achievements
Rank 2
 answered on 19 Aug 2009
4 answers
116 views
Hello !

I have an error on Internet Explorer 8 with RadCombobox.

I open a RadWindow from the RadScheduler in which i have this :

<telerik:RadComboBox ID="CB_Groupe" runat="server" Skin="Black" DataSourceID="AccessDataSource3" 
DataTextField="nom_groupe" DataValueField="groupes_id" AutoPostBack="true" AppendDataBoundItems="true"  
AutoCompleteSeparator=";" MarkFirstMatch="true" Width="200px" Height="150px" Style="z-index: 100002;"
</telerik:RadComboBox> 

But on IE8, i have an error on the display, I made a video capture to show you the problem :
http://www.id3i.fr/vrac/erreuraffichageIE8.swf

When I pass the mouse over the control, the display is done, otherwise it does not appear.

Any ideas ?


Francois MARTIN
Top achievements
Rank 2
 answered on 19 Aug 2009
7 answers
198 views
Hello,

I'm trying to accomplish the following scenario with a  grid in hierachy model 3 levels deep using the OnNeedDataSource and OnDetailTableDataBind events. The grid can be refreshed with a button to get different data loaded using ajax and a forced databind() (server side) af refreshing the business layed on which the grid binds to.

1 - After load, no visiblitity of the filterrow
2 - Change visibility by using a radio button 
3 - changing preferably client side.
4 - after refreshing data the state of the filterrow should be preserved.
5 - on expanding the detailtable the filteritem of the datatable should also have the same visibility status as its mastertabelview

So far i've tried several soltutions, found here in this forum, but non of them worked for this scenario. 

i've written this piece of javascript to enable of disable the filters client side and this works.

       function showFilterItem() { 
            var grid = $find("<%= RadGrid1.ClientID %>"); 
            grid.get_masterTableView().showFilterItem(); 
            //get all detail tables in the hierarchy 
            var detailTablesArray = grid.get_detailTables(); 
 
 
            for (var x = 0; x < detailTablesArray.length; x++) { 
                detailTablesArray[x].showFilterItem(); 
            } 
        } 
        function hideFilterItem() { 
            var grid = $find("<%= RadGrid1.ClientID %>"); 
            grid.get_masterTableView().hideFilterItem(); 
            //get all detail tables in the hierarchy 
            var detailTablesArray = grid.get_detailTables(); 
 
            for (var x = 0; x < detailTablesArray.length; x++) { 
                detailTablesArray[x].hideFilterItem(); 
            } 
        } 
      
Please advice.
koen van daalen
Top achievements
Rank 1
 answered on 19 Aug 2009
4 answers
188 views
HI

I am having a radgrid and want to access the rows from an asp.net button clientside.

<

 

asp:LinkButton ID="LinkButton1" runat="server" OnClick="lnkbtnAddSlot_New_Click"

 

 

Width="97px" CssClass="sf-inputsLinkButton" OnClientClick="return AddSlot_New()">Add Slot_New</asp:LinkButton>

OnClientClick I want to access the no. of rows in radgrid and the values of the cells.

I used

 

 

var gvWorkingHours = $find("<%= gvWorkingHours_New.ClientID %>").get_masterTableView();

 

 


This is becoming null always.

for
(var i = 0; i < gvWorkingHours.get_masterTableView().get_dataItems().length; i++)

 

{

 

var row = Rows[i];

 

 

var textbox1 = row.findControl("txtSlotName"); //

 

 

 

 

}

Please suggest solution.

Below is the entire source  code.

------------
aspx page
---

 

<%

@ Page Language="C#" AutoEventWireup="true"

 

 

 

 

MasterPageFile

 

="~/EnterpiseConsoleFiles/MasterPage.master" CodeFile="Default.aspx.cs" Inherits="_Default" %>

 

<%

@ Register Assembly="RadCalendar.Net2" Namespace="Telerik.WebControls" TagPrefix="radCln" %>

 

<%

@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="radA" %>

 

<%

@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>

 

 

 

 

<

 

asp:Content ID="content" runat="server" ContentPlaceHolderID="Cont">

 

 

 

 

 

 

<script type="text/javascript">

 

 

 

 

 

 

function TestHandler(sender, eventArgs)

 

{

 

var oldTime = eventArgs.oldTime;

 

 

var newTime = eventArgs.newTime;

 

 

var msg = "Time changed from ";

 

 

if (oldTime)

 

msg = msg + oldTime;

 

else

 

 

 

 

 

msg = msg +

"nothing";

 

msg = msg +

" to ";

 

 

if (newTime)

 

msg = msg + newTime;

 

else

 

 

 

 

 

msg = msg +

"nothing";

 

 

alert(msg);

}

 

function AddSlot_New()

 

{

 

debugger;

 

 

 

var gvWorkingHours = $find("<%= gvWorkingHours_New.ClientID %>").get_masterTableView();

 

 

for (var i = 0; i < gvWorkingHours.get_masterTableView().get_dataItems().length; i++)

 

{

 

var row = Rows[i];

 

 

var textbox1 = row.findControl("txtSlotName"); //

 

 

 

 

 

}

}

 

 

 

function DateSelected(sender, args)

 

{

 

var text = args.newTime;

 

alert(

'sree');

 

}

 

function error(sender, args)

 

{

 

var text = args.get_inputText;

 

alert(

'dhar');

 

}

 

</script>

 

 

 

 

 

 

 

 

<div>

 

 

 

 

 

 

<rad:RadGrid ID="gvWorkingHours_New" runat="server" Skin="SkeltaGrid" AutoGenerateColumns="false"

 

 

 

 

 

 

>

 

 

 

 

 

 

<MasterTableView>

 

 

 

 

 

 

<Columns>

 

 

 

 

 

 

<rad:GridTemplateColumn>

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

<asp:TextBox runat="server" ID="txtSlotName" CssClass="inputsNoExpression" Text='<%# Eval("SlotName") %>'></asp:TextBox>

 

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

 

</rad:GridTemplateColumn>

 

 

 

 

 

 

<rad:GridTemplateColumn>

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

<radCln:RadTimePicker ID="rtpFromTime" Width="31%" runat="server" TabIndex="2" EnableTyping="true"

 

 

 

 

 

 

TimeView-TimeFormat="HH:mm" DateInput-DateFormat="HH:mm" DateInput-DisplayDateFormat="HH:mm"

 

 

 

 

 

 

DateInput-EmptyMessage="From Time" DBSelectedDate='<%# Eval("FromTime") %>'>

 

 

 

 

 

 

<TimeView ID="tvFrom" runat="server" ShowHeader="False" Interval="00:30" Columns="3">

 

 

 

 

 

 

</TimeView>

 

 

 

 

 

 

 

<ClientEvents OnDateSelected="DateSelected" />

 

 

<DateInput>

 

 

<ClientEvents OnError="error" />

 

 

</DateInput>

 

 

</radCln:RadTimePicker>

 

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

 

</rad:GridTemplateColumn>

 

 

 

 

 

 

<rad:GridTemplateColumn>

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

<radCln:RadTimePicker ID="rtpToTime" Width="31%" runat="server" TabIndex="2" EnableTyping="true"

 

 

 

 

 

 

TimeView-TimeFormat="HH:mm" DateInput-DateFormat="HH:mm" DateInput-DisplayDateFormat="HH:mm"

 

 

 

 

 

 

DateInput-EmptyMessage="To Time" DBSelectedDate='<%# Eval("ToTime") %>'>

 

 

 

 

 

 

<TimeView ID="tvTo" runat="server" ShowHeader="False" Interval="00:30" Columns="3"

 

 

 

 

 

 

OnClientTimeSelected="TestHandler">

 

 

 

 

 

 

</TimeView>

 

 

 

 

 

 

</radCln:RadTimePicker>

 

 

</ItemTemplate>

 

 

 

 

 

 

</rad:GridTemplateColumn>

 

 

 

 

 

 

 

<rad:GridTemplateColumn>

 

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

 

<asp:CompareValidator ID="dateCompareValidator" runat="server" ControlToValidate="rtpToTime"

 

 

 

 

 

 

ControlToCompare="rtpFromTime" Operator="GreaterThan" Type="String" ErrorMessage="To Date must be greater than From Date">

 

 

 

 

 

 

</asp:CompareValidator>

 

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

 

</rad:GridTemplateColumn>

 

 

 

 

 

 

</Columns>

 

 

 

 

 

 

</MasterTableView>

 

 

 

 

 

 

</rad:RadGrid>

 

 

 

 

 

 

<asp:LinkButton ID="LinkButton1" runat="server" OnClick="lnkbtnAddSlot_New_Click"

 

 

 

 

 

 

Width="97px" CssClass="sf-inputsLinkButton" OnClientClick="return AddSlot_New()">Add Slot_New</asp:LinkButton>

 

 

 

 

 

 

</div>

 

 

 

 

 

 

</asp:Content>

 

code behind
-----------------

 

using

 

System;

 

 

 

using

 

System.Data;

 

 

 

using

 

System.Configuration;

 

 

 

using

 

System.Collections;

 

 

 

using

 

System.Web;

 

 

 

using

 

System.Web.Security;

 

 

 

using

 

System.Web.UI;

 

 

 

using

 

System.Web.UI.WebControls;

 

 

 

using

 

System.Web.UI.WebControls.WebParts;

 

 

 

using

 

System.Web.UI.HtmlControls;

 

 

 

using

 

Telerik.WebControls;

 

 

 

public

 

partial class _Default : System.Web.UI.Page

 

 

 

 

{

 

protected void Page_Load(object sender, EventArgs e)

 

{

 

if (!IsPostBack)

 

{

SetInitialRowForSlots_New();

}

}

 

private void SetInitialRowForSlots_New()

 

{

 

DataTable dtSlots = new DataTable();

 

dtSlots.Columns.Add(

new DataColumn("SlotName", typeof(string)));

 

dtSlots.Columns.Add(

new DataColumn("FromTime", typeof(string)));

 

dtSlots.Columns.Add(

new DataColumn("ToTime", typeof(string)));

 

 

DataRow drSlot = dtSlots.NewRow();

 

drSlot[

"SlotName"] = string.Empty;

 

drSlot[

"FromTime"] = new TimeSpan(0, 0, 0);

 

drSlot[

"ToTime"] = new TimeSpan(0, 0, 0);

 

dtSlots.Rows.Add(drSlot);

gvWorkingHours_New.DataSource = dtSlots;

gvWorkingHours_New.DataBind();

}

 

protected void lnkbtnAddSlot_New_Click(object sender, EventArgs e)

 

{

 

DataTable dtSlots = new DataTable();

 

dtSlots.Columns.Add(

new DataColumn("SlotName", typeof(string)));

 

dtSlots.Columns.Add(

new DataColumn("FromTime", typeof(string)));

 

dtSlots.Columns.Add(

new DataColumn("ToTime", typeof(string)));

 

 

foreach (GridDataItem pkgItem in gvWorkingHours_New.MasterTableView.Items)

 

{

 

TextBox SlotName = pkgItem.FindControl("txtSlotName") as TextBox;

 

 

RadTimePicker FrTime = pkgItem.FindControl("rtpFromTime") as RadTimePicker;

 

 

RadTimePicker ToTime = pkgItem.FindControl("rtpToTime") as RadTimePicker;

 

 

DataRow dr = dtSlots.NewRow();

 

dr[

"SlotName"] = SlotName.Text;

 

dr[

"FromTime"] = new TimeSpan(((DateTime)(FrTime.DbSelectedDate)).TimeOfDay.Hours, ((DateTime)(FrTime.DbSelectedDate)).TimeOfDay.Minutes, 0);

 

dr[

"ToTime"] = new TimeSpan(((DateTime)(ToTime.DbSelectedDate)).TimeOfDay.Hours, ((DateTime)(ToTime.DbSelectedDate)).TimeOfDay.Minutes, 0);

 

dtSlots.Rows.Add(dr);

}

 

DataRow drEmpty = dtSlots.NewRow();

 

drEmpty[

"SlotName"] = string.Empty;

 

drEmpty[

"FromTime"] = new TimeSpan(0, 0, 0);

 

drEmpty[

"ToTime"] = new TimeSpan(0, 0, 0);

 

dtSlots.Rows.Add(drEmpty);

gvWorkingHours_New.DataSource = dtSlots;

gvWorkingHours_New.DataBind();

}

 

}


Regards
Sreedhar Ambati

Shinu
Top achievements
Rank 2
 answered on 19 Aug 2009
1 answer
178 views
I am having the hardest time trying to get the value of a rad treenode when i'm using the radcontextmenu.  When I right click the item, I'm using the OnClientContextMenuShowing event to be able to capture this information in javascript.  How can I get the value of the treenode that the context menu is associated with.  Also, if I view source on the page with the rad treeview, I can't see the value stored anywhere in the html like I would if I set the value of a ASP.Net treeview control.  Any help would be appreciated as this should be a relatively easy and common scenario.  I don't want to use server side options just to be clear.  Thanks in advance for your help.
Princy
Top achievements
Rank 2
 answered on 19 Aug 2009
1 answer
199 views
Hello,

I have created a custom skin.  It was derived from a classic version skin, changed to match Ajax version taxonomy.  Unfortunately, the default skin (RadPanelBar.css) still overrides many of my settings.  I know my custom skin is working because the results show my images and some of my settings that are not contained within the default Css.  How do I stop the CssClass reference from being added, or how do I add an empty default Css?

Here is my page registration:

 <link href="/_skins/RadPanelBar/SoEasy/PanelBar.SoEasy.css" rel="stylesheet" type="text/css" runat="server" />

(The structure is as indicated within the documentation whereby there is also a PanelBar directory within .../SoEasy that contains my images.)

Here is my control callout:

     <telerik:radpanelbar runat="server" ID="RadPanelbar1" ExpandMode="MultipleExpandedItems" ExpandDelay="3000" CollapseDelay="3000" EnableEmbeddedSkins="false" Skin="SoEasy" DataSourceId="QuickLaunchSiteMap" OnClientLoad="panelLoad" OnClientItemClicking="OnClientItemClickingHandler" OnClientMouseOver="OnClientMouseOverPanHandler" OnPreRender="RadControl_PreRender" PersistStateInCookie="false" ToolTip="">
     
      <ExpandAnimation Type="Linear" Duration="300" />
      <CollapseAnimation Type="Linear" Duration="100" />     
     </telerik:radpanelbar></div>

Here is the resulting output showing the default RadPanelBar having precedence over my custom skin:

<div class="RadPanelBar RadPanelBar_SoEasy nothing" id="ctl00_PlaceHolderLeftNavBar_RadPanelbar1">
  <ul class="rpRootGroup">
   <li class="rpItem rpFirst rpLast"><a class="rpLink rpExpandable rpExpanded" href="/sites/master/site%20pages/go_nowhere.aspx"><span class="rpOut"><span class="rpText">Community Access</span></span></a><div class="rpSlide" style="height: auto; display: block;">
    <ul class="rpGroup rpLevel1" style="overflow: auto; display: block; width: 100%;">
     <li class="rpItem rpFirst rpLast"><a class="rpLink rpExpandable" href="/sites/master/community/default.aspx"><span class="rpOut"><span class="rpText">Enter Private Site</span></span></a><div class="rpSlide">
      <ul class="rpGroup rpLevel2">
       <li class="rpItem rpFirst"><a class="rpLink" href=" class="rpOut"><span class="rpText">Recover Password</span></span></a></li><li class="rpItem rpLast"><a class="rpLink" href=" class="rpOut"><span class="rpText">Create Account</span></span></a></li>
      </ul>
     </div></li>
    </ul>
   </div></li>
  </ul><input type="hidden" name="ctl00_PlaceHolderLeftNavBar_RadPanelbar1_ClientState" id="ctl00_PlaceHolderLeftNavBar_RadPanelbar1_ClientState" autocomplete="off" value='{"expandedItems":["0"],"logEntries":[],"selectedItems":[]}'/>
 </div>

Your help would be appreciated.

Thank you,

Doug
Alex Gyoshev
Telerik team
 answered on 19 Aug 2009
1 answer
615 views
I am having a problem with the onkeyup event when using a RadTextBox.  Its seems to fire ok, however the changes to the text field are not reflected before the event fires.  So when it fires, any text entered that causes the event is not being seen in my javascrip fuction.  Has anyone seen this before?  If so, how do i rectify it?

Thanks in advance.
Michael
Shinu
Top achievements
Rank 2
 answered on 19 Aug 2009
4 answers
138 views
Hello,

I am attempting to evaluate the Telerik suite for purchase.  I am currently going through the RadControl for ASP.net ajax courseware .pdf. (794 Pages).   I am trying to get client side databinding to work for the grid.  I am using the tutorial on page 501 titled client side databinding.

I went through the tutorial and I also simply ran the packaged code of the very same tutorial and I am getting the same error in both my application and the example that was distributed with the tutorial.

I am getting the following error:  'Null" is null or not an object.

This error happens when the following line of code is called from within the javascript function updateGrid(result)

error happens here ---> tableView.set_dataSource(result);

when I break into the c# code, my customer objects are getting populated and when I check what "result" is in the javascript updateGrid() function just before calling the set_dataSource(result) line it shows a populated object.  Not sure why the above line of code keeps bombing. 

Can someone who has worked with these tools please verify to me that the sample project works for this tutorial. Any suggestions?

I am currently evaluating version 2008.3..1125.35 and using VS 3.5 SP 1
elmosi
Top achievements
Rank 2
 answered on 19 Aug 2009
1 answer
198 views
Hi:
 In this sample Radcombox with checkboxes

How can I select the first option in the codebehind, so Its text can appear in the textbox and its correspondent checkbox is checked.

Thanks in advance.
Princy
Top achievements
Rank 2
 answered on 19 Aug 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?