Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
141 views
I am having a problem when trying to get the master table view of a grid in a window.onload function.  It works fine when the form first loads, but failes to find the grid on the postback.

Here's the javascript:

 

 

 

 

 

 

 

 

<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">

 

 

 

<script type="text/javascript" >

 


window.onload =

 

function () {

 

 

   var masterTable = $find("<%= radGridCashFlows.ClientID 
%>").get_masterTableView();
   masterTable.selectItem(masterTable.get_dataItems()[0].get_element());

 And here's the grid control:

 

 

 

<telerik:RadGrid ID="radGridCashFlows" runat="server" Width="520px" Height="135px" Skin="Default" AllowMultiRowSelection="false" >

 

 

 

<ClientSettings EnableRowHoverStyle="true" >

 

 

 

<ClientEvents OnRowClick="CFSelected" />

 

 

 

<Selecting AllowRowSelect="True" UseClientSelectColumnOnly="true" />

 

 

 

<Scrolling AllowScroll="true" SaveScrollPosition="true" UseStaticHeaders="true" />

 

 

 

</ClientSettings>

 

 

 

<MasterTableView AutoGenerateColumns="false" Font-Size="Larger" ClientDataKeyNames="CFDesc,CFTypeDesc,CFAcctTypeName,CFID,CFTypeID,ScenTargetID,StartYear,EndYear,YearlyReqment,InflationPct" DataKeyNames="CFDesc,CFTypeDesc,CFAcctTypeName,CFID,CFTypeID,ScenTargetName" NoMasterRecordsText="No Cash Flows Created.." >

 

 

 

<Columns>

 

 

 

<telerik:GridBoundColumn

 

 

 

DataField="CFDesc"

 

 

 

HeaderText="Cash Flow Name:"

 

 

 

SortExpression="CFDesc"

 

 

 

UniqueName="CFDesc"

 

 

 

HeaderStyle-Width="140px" />

 

 

 

<telerik:GridBoundColumn

 

 

 

HeaderStyle-Width="150px"

 

 

 

DataField="CFTypeDesc"

 

 

 

HeaderText="CF Type:"

 

 

 

SortExpression="CFTypeDesc"

 

 

 

UniqueName="CFTypeDesc" />

 

 

 

<telerik:GridBoundColumn

 

 

 

HeaderStyle-Width="90px"

 

 

 

DataField="CFAcctTypeName"

 

 

 

HeaderText="Acct. Type:"

 

 

 

SortExpression="CFAcctTypeName"

 

 

 

UniqueName="CFAcctTypeName" />

 

 

 

<telerik:GridBoundColumn

 

 

 

HeaderStyle-Width="120px"

 

 

 

DataField="ScenTargetName"

 

 

 

HeaderText="Solve For:"

 

 

 

SortExpression="ScenTargetName"

 

 

 

UniqueName="ScenTargetName" />

 

 

 

<telerik:GridBoundColumn

 

 

 

DataField="CFID"

 

 

 

HeaderText="CFID:"

 

 

 

Visible="false" />

 

 

 

<telerik:GridBoundColumn

 

 

 

DataField="CFTypeID"

 

 

 

HeaderText="CFTypeID:"

 

 

 

Visible="false" />

 

 

 

<telerik:GridBoundColumn

 

 

 

DataField="ScenTargetID"

 

 

 

HeaderText="ScenTargetID:"

 

 

 

Visible="false" />

 

 

 

<telerik:GridBoundColumn

 

 

 

DataField="StartYear"

 

 

 

HeaderText="StartYear:"

 

 

 

Visible="false" />

 

 

 

<telerik:GridBoundColumn

 

 

 

DataField="EndYear"

 

 

 

HeaderText="EndYear:"

 

 

 

Visible="false" />

 

 

 

<telerik:GridBoundColumn

 

 

 

DataField="YearlyReqment"

 

 

 

HeaderText="YearlyReqment:"

 

 

 

Visible="false" />

 

 

 

<telerik:GridBoundColumn

 

 

 

DataField="InflationPct"

 

 

 

HeaderText="InflationPct:"

 

 

 

Visible="false" />

 

 

 

</Columns>

 

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>

 


I am doing this so that I can fire a javascript function that sets some page characteristics based on the current grid row.  I could do this server-side, but I have the Js function written, and don't want to duplicate the logic.  Any suggestions would be appreciated.

Thanks,
Shahryar

 

 

 

Shahryar Ali
Top achievements
Rank 1
 answered on 10 Sep 2010
1 answer
151 views
I'm having an issue when I clear the selected value of a ComboBox via client side javascript.  The box appears to remove the selected text, but on postback the original text is still selected (and displays in the ComboBox's textbox).  In other words, clicking the reset button does not clear my selection from the ComboBox.

Here's the javascript:

 

<script language="javascript" type="text/javascript">
function clearAllControls() {

 

var vendor = $find("<%= ddVendor.ClientID %>"); 
if (vendor!=null) {
vendor.trackChanges();

 

 

vendor.set_text(

"");
vendor._applyEmptyMessage();

 

 

vendor.commitChanges();

}

 

return false;
}
</script>

I've also tried:

 

 

 

<script language="javascript" type="text/javascript">
function clearAllControls() {

 

var vendor = $find("<%= ddVendor.ClientID %>");
if (vendor!=null) {
vendor.clearSelection();
vendor.commitChanges();

 

 

 

}

 

return false;
}
</script>

Here's the aspx:
<asp:Button ID="btnReset" runat="server" ResourceId="NewOrderSearch_ResetButton" Text="Reset" OnClientClick="clearAllControls(); return true;" CausesValidation="false" />

 

 

 


 

 

 

 

 

Cori
Top achievements
Rank 2
 answered on 10 Sep 2010
2 answers
154 views
hi, 

currently I don't seem to be able to get the captcha audio from an IIS7 deployed website, when debugging locally on my machine there is no problem.  Do you have any suggestions?

Thanks
R
Jon Shipman
Top achievements
Rank 1
 answered on 10 Sep 2010
2 answers
116 views
Hi all,

I've a question about styling the RadMenu. I'm not so good in CSS, but I have this challenge to make this menu work in Sitefinity.

The code for the menu is like this:
<ul id="nav">
   <li class="active">
      <a href="#"><span class="l"><span class="c">Home</span></span><span class="r"> </span>
      </a>
   </li>
   <li>
      <a href="#"><span class="l"><span class="c">Maatschappelijke stages</span> </span><span class="r"> </span>
      </a>
   </li>
   <li>
      <a href="#"><span class="l"><span class="c">Contact</span></span><span class="r"> </span>
      </a>
   </li>
</ul>

This is my CSS code:
#nav{
    list-style:none;
    padding:0;
    margin:0;
    overflow:hidden;
    height:50px;
    background:url(../Img/bg-nav.gif) repeat-x 0 100%;
    text-transform:uppercase;
}
#nav li{
    float:left;
    font:24px/27px BigNoodleTitlingRegular, Arial, Helvetica, sans-serif;
    margin:0 0 0 -4px;
}
#nav a{
    float:left;
    letter-spacing:-1px;
}
#nav a:hover,
#nav .active a{
    color:#000;
    text-decoration:none;
    border:0;
    cursor:pointer;
}
#nav span{float:left;}
#nav .c{padding:20px 10px 3px;}
#nav .l{padding:0 0 0 8px;}
#nav .r{
    width:8px;
    height:50px;
}
#nav a:hover .l,
#nav .active .l{background:url(../Img/bg-nav-left-hover.png) no-repeat;}
#nav a:hover .c,
#nav .active .c{
    background:url(../Img/bg-nav-center-hover.png) repeat-x;
    overflow:hidden;
}
#nav a:hover .r,
#nav .active .r{background:url(../Img/bg-nav-right-hover.png) no-repeat;}

I do not understand how I can transform this into a RadMenu_Custom skin. Because of the <span> tags that are around the menu items. I don't know if it is possible for the RadMenu to just output <ul> and <li>?

Anyway, if there is anyone that has done such kind of styling: I really could use some help.

Thanks!
Daniel
Daniel Plomp
Top achievements
Rank 2
 answered on 10 Sep 2010
2 answers
234 views
Hi,

     I am unable to get the ClientID fo the Rad Combo box control ($find("<%= rComboResultsPerPage.ClientID %>") which is present in the Pager Template of the Rad Grid. Is there any way to fetch it? I have pasted my working code below.


<script type="text/javascript">
        function pageLoad(sender, args) {
                gridCount = parseInt(document.getElementById("<%= hidGridCount.ClientID %>").value);
                if (gridCount > 0)
               var  tableView = $find("<%= radgridEventSearch.ClientID %>").get_masterTableView();
              var savedValue = $get("RadComboBox1Value").value;
                  var combo = $find("<%= rComboResultsPerPage.ClientID %>");
              if (savedValue != "" && combo.findItemByValue(savedValue)) {
                            combo.findItemByValue(savedValue).select();
                        }
        }

</script>

<telerik:RadGrid ID="radgridEventSearch" runat="server" GridLines="None" AllowPaging="True"
                                EnableViewState="false" AllowCustomPaging="true" VirtualItemCount="1000000" AllowSorting="True"
                                AutoGenerateColumns="false" Skin="Vista" OnSortCommand="radgridEventSearch_SortCommand"
                                OnNeedDataSource="radgridEventSearch_NeedDataSource" PageSize="25">
<MasterTableView AllowCustomSorting="true" AllowNaturalSort="false">
                                    <PagerTemplate>
                                <!-- There is some additional code goes here -->
        <telerik:RadComboBox ID="rComboResultsPerPage" DataSource="<%# FillResultsPerPageDropDownList() %>"
         SelectedValue='<%# (int)DataBinder.Eval(Container, "Paging.PageSize") %>' runat="server"
         OnClientSelectedIndexChanged="rComboResultsPerPage_SelectedIndexChanged" Width="50px">
            </telerik:RadComboBox>
        <!-- There is some additional code goes here -->
         </PagerTemplate>
    <PagerStyle PageButtonCount="10" Position="TopAndBottom" AlwaysVisible="true" />
<!-- There is some additional code goes here -->
<asp:HiddenField ID="hidGridCount" Value="0" runat="server" />                           
<input type="hidden" id="RadComboBox1Value" value="" />

Thanks
Rama Rao

Rama Rao
Top achievements
Rank 1
 answered on 10 Sep 2010
5 answers
164 views
I have a web service based treeview set up and basically what I'm aiming to do is give the node a target. The set up is that this treeview is in a left frame, and the nodes are images that will be loaded in the right hand frame. I'm running this through a web service and the RadTreeNodeData class doesn't have the "Target" attribute like the RadTreeNode variable does. Is there a way to have a target on the nodes? I've given my code below and after searching around, it's all that I've found. Let me know if I'm doing something incorrectly, thanks

<
telerik:RadTreeView EnableViewState="true" ID="treeImages" runat="server"
 DataFieldID="Id" DataFieldParentID="ParentId" DataTextField="Text"
 DataValueField="Value" DataNavigateUrlField="NavigateURL" OnClientNodeDataBound="OnClientNodeDataBoundHandler">
  <WebServiceSettings Path="FolderTree.aspx" Method="LoadPromotionNodes" />
    <DataBindings>
      <telerik:RadTreeNodeBinding Expanded="false" />
    </DataBindings>
</telerik:RadTreeView>
for (int row = 0; row < rowMax; row++)
{
    returnNode.Text = _returnArray[row, 0];
    returnNode.Value = _returnArray[row, 1];
    returnNode.Attributes["Target"] = "fraRightFrame";
    returnNode.ExpandMode = TreeNodeExpandMode.WebService;
    returnNode.NavigateUrl = "images.aspx?loc=" + _returnArray[row, 1];                
    result.Add(returnNode);
}
return result.ToArray();

<script type="text/javascript">
    function OnClientNodeDataBoundHandler(sender, e) {
        var node = e.get_node();
        var target = node.get_attributes().getAttribute("Target");
        node.get_attributes().setAttribute("Target", target);
    }
</script>
Nikolay Tsenkov
Telerik team
 answered on 10 Sep 2010
3 answers
146 views
Is it possible to implement an Even-Odd custom filter? The following in the Grid's Item_Command event causes an
unexpected char: '%' error.


if (e.CommandName == RadGrid.FilterCommandName)
{
    Pair filterPair = (Pair)e.CommandArgument;
    if (filterPair.First.ToString() == "Custom")
    {
        string colName = filterPair.Second.ToString();
         
        TextBox tbPattern = (e.Item as GridFilteringItem)[colName].Controls[0] as TextBox;
        string[] values = tbPattern.Text.Split(' ');
        if (values.Length == 1)
        {
            e.Canceled = true;
            //string newFilter = "mod(" + filterPair.Second +",2)" + "=" + values[0];
            string newFilter = "(" + filterPair.Second + " % 2) ="+values[0];
            if (RadGrid1.MasterTableView.FilterExpression == "")
            {
                RadGrid1.MasterTableView.FilterExpression = newFilter;
            }
            else
            {
                RadGrid1.MasterTableView.FilterExpression = RadGrid1.MasterTableView.FilterExpression+ "AND" + newFilter;
            }
            RadGrid1.Rebind();
        }
    }

Martin
Telerik team
 answered on 10 Sep 2010
4 answers
202 views
Hello,
Is there a way to have a tooltip column that will get the data from database using WCF
for the grid that have client side edit/add as in link below?
http://demos.telerik.com/aspnet-ajax/grid/examples/client/insertupdatedelete/defaultcs.aspx


I cannot use tooltip manager as the grid is not bound on server side. So i cannot use updated column collection.

Regards
Mac
Martin
Telerik team
 answered on 10 Sep 2010
2 answers
149 views
Hi all,

This seems like it should be so easy, but it's not. I have a custom sub to handle the insert command. After done, I rebind my grid and the data shows up normally, but I'm still in "insert" mode. How do I get out of it?

The RadGrid is embedded within a formview control, so here is my rebind code:

Dim gvWebsites As RadGrid
gvWebsites = TryCast(frmFeederFund.FindControl("gvWebsites"), RadGrid)
gvWebsites.Rebind()

Thanks for your help!
David Arnold
Top achievements
Rank 2
 answered on 10 Sep 2010
1 answer
111 views
I have a grid with update and delete buttons.  Above the grid, I have a form for adding and updating the grid items with a save (submit)button.  If there are no items in the grid and the user presses the Enter key, the item in the form is added to the grid.  Once there are items in the grid, when the user presses the Enter key the first itme in the grid is deleted.  Any ideas why this would happen?  I have tried setting the grid's ClientSettings.KeyboardNavigationSettings.EnableKeyboardShortcuts to false but that did not change the behavior.

Thanks -- Kristin
Mira
Telerik team
 answered on 10 Sep 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?