Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
124 views
I have a RadGrid nested in another RadGrid.

In the nested RadGrid I have enabled Allow Automatic Updates and Deletes.   However I want to disable or set the value of these buttons to be invisible if a value in my SQL database = 1.  This field is in the NestedGrid - although set to visible = false.

How would y'all go about hiding the buttons?  Do I need to remove the Automatic Updates / Deletes and add custom buttons?
Princy
Top achievements
Rank 2
 answered on 17 Jan 2011
1 answer
50 views
I don't have a key between the master and detail tables . How can I load the detail tables at runtime from a datatable instead of having the relationship between master and detail tables. 

Raja
Princy
Top achievements
Rank 2
 answered on 17 Jan 2011
1 answer
52 views
Hi,

In my dynamic radgrid i create one template column with html image control. But in row data bound i can't find that control.

it come as null. Based on data i want to give image path on that.

any idea? Please help me ASAP.


Thanks
Vignesh
Shinu
Top achievements
Rank 2
 answered on 17 Jan 2011
1 answer
74 views
hi
i have 3 templatefield

 <telerik:GridTemplateColumn HeaderText="????">
                    <ItemTemplate>
                    <asp:Label ID="lblPrice" runat="server" Text='<%# CDS.Savin.WebUI.Generals.General.numberToMoney(Eval("Price").ToString()) %>' ></asp:Label>
                    </ItemTemplate>
                    </telerik:GridTemplateColumn>
                     <telerik:GridTemplateColumn HeaderText="?????">
                    <ItemTemplate>
                    <asp:TextBox runat="server" ID="txtDiscount" OnKeyUp="keyupHandler1();" ></asp:TextBox>
                    </ItemTemplate>
                    </telerik:GridTemplateColumn>
                       <telerik:GridTemplateColumn HeaderText="???? ??" >
                    <ItemTemplate>
                    <asp:Label runat="server" ID="lblTotalPrice"></asp:Label>
                    </ItemTemplate>
                    </telerik:GridTemplateColumn>
when user type number in to "txtDiscount " i want :lblTotalPrice.Text=lblPrice.text-txtDiscount.Text
please help to me
thanks
Shinu
Top achievements
Rank 2
 answered on 17 Jan 2011
0 answers
117 views
i am using treeview and gets parent id from database..if i will drop node to another parent it should change its parent id in database also..Plz share your views..
SqllConnection con = new SqlConnection("Server=HUZAIF-PC;Database=ShoppingOnline;Integrated Security=True");
        SqlCommand cmd = new SqlCommand("SELECT * FROM product_table",con);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
       // da.SelectCommand.Parameters.Add("@parentID", SqlDbType.VarChar, 50).Value = parentID;
        DataTable links = new DataTable();
        da.Fill(links);
        treeView.DataTextField = "product_Name";
        treeView.DataFieldID = "product_ID";
        treeView.DataFieldParentID = "parent_ID";
        treeView.DataValueField  = "product_ID";
        treeView.DataSource = links;
        treeView.DataBind()
umar
Top achievements
Rank 1
 asked on 17 Jan 2011
1 answer
51 views
I am trying to conditionally edit a parent row in a hierarchy grid. How do I access just the row of the parent or master table?

It would be nice if the GridDataItem had a IsParent.

Thanks.
Princy
Top achievements
Rank 2
 answered on 17 Jan 2011
1 answer
75 views
Sorry if this is too basic a question, just got started.

I was trying grouping in RadGrid, all went fine except in the group header, it always shows FieldNameOrAlias : FieldValue.  I just want the Value in the group header, not prefixed with Name:  So instead of

My Country: Argentina; My Items: 3; Group Total : $8,119.10

I want something like

Argentina       3               $8,119.10

Can this be done, declaratively or programmatically, without looping through OnItemDataBound?  Thanks.
Princy
Top achievements
Rank 2
 answered on 17 Jan 2011
1 answer
280 views
Hi,
Can someone please help me with the following issue.

I am using Frameset in default.aspx page
<frameset border="0" rows="75,*,10" id="0">
        <frame name="contentmenu" src="<%=menuUrl%>" scrolling="no" noresize="noresize" frameborder="0" />     
        <frameset border="0" cols="284,*" frameborder="0" framespacing="0" runat="server" id="colsFrameset" enableviewstate="false">
            <frame name="contenttree" src="ContentMenu.aspx" scrolling="no" frameborder="0" framespacing="0" border="0" runat="server" id="frameTree" class="TreeFrame" />
            <frame name="contentview" src="../UnderConstruction.aspx" frameborder="0" border="0" framespacing="0" runat="server" id="frameView" />
        </frameset>
        <frame name="contentfooter" src="footer.aspx" scrolling="no" noresize="noresize" frameborder="0" />    
        <noframes>
            <p id="p1">
                This HTML frameset displays multiple Web pages. To view this frameset, use a
                Web browser that supports HTML 4.0 and later.
            </p>
        </noframes>
    </frameset>

in my left frame in ContentMenu.aspx page I have created radtreeview with contextmenu. What I am trying to achieve is when the context menu will be clciked that time time a new page will be create on contentView frame. here is  my leftframe page source....
<script type="text/javascript">
     //<![CDATA[
     function LoadItem(elementName, elementUrl) {
         parent.frames['contentview'].location.href = elementUrl;
     }

     //]]>
    </script>
<
telerik:RadTreeView ID="RadTreeView1" runat="server" CausesValidation="false " OnNodeClick="RadTreeView1_NodeClick"
                   OnContextMenuItemClick="RadTreeView1_ContextMenuItemClick">
                   <ContextMenus>
                       <telerik:RadTreeViewContextMenu ID="RadTreeViewContextMenu1" runat="server">
                           <Items>
                               <telerik:RadMenuItem runat="server" Text="Add New Page" PostBack="true">
                               </telerik:RadMenuItem>
                               <telerik:RadMenuItem runat="server" Text="Remove" PostBack="true">
                               </telerik:RadMenuItem>
                           </Items>
                       </telerik:RadTreeViewContextMenu>
                   </ContextMenus>
                   <DataBindings>
                       <telerik:RadTreeNodeBinding Expanded="true" />
                   </DataBindings>
               </telerik:RadTreeView>

I am trying to call javascript function LoadItem when the contextmenu Item will be clicked. here is my codebehind file.
protected void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e)
        {
            this.NodeText = e.Node.Value;
 
        }
 
protected void RadTreeView1_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)
        {
            if (e.MenuItem.Text == "Add New Page")
            {
                //radpanel1.Visible = true;
                //txtTile.Text = this.NodeText;
                e.MenuItem.NavigateUrl = "http://www.google.com";
                e.MenuItem.Target = "contentview";
            }
            else if (e.MenuItem.Text == "Remove")
            {
                RadTreeView1.SelectedNode.Remove();
            }
        }

but its not working. can anyone please help me to make work with calling javascript function with given url .
Thanks.
Nano
Top achievements
Rank 1
 answered on 17 Jan 2011
4 answers
111 views
Hi All,
I have seen some posts on this already, but don't think the work arounds apply to what I am experiencing.
Basically, if I setup the datagrid with a server-side ItemCommand event, the ItemIndex is correct.
Adding in a client-side OnCommand event, however, makes the ItemIndex server-side always 0 (zero).  Interestingly, the get_commandArgument returns the correct value within the OnGridCommand event (see example).
Why is this?  See below for an example.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="GridButtonIndex.aspx.cs"
    Inherits="TestTelerikWebApp.GridButtonIndex" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function OnGridCommand(sender, args) {
                var grid = sender;
                debugger;
                if (args.get_commandName() == "InitInsert" && grid._editIndexes[0] >= 0) {
                    alert("Cannot add while editing a record.");
                    args.set_cancel(true);
                }
                if (args.get_commandName() == "Delete") {
                    if (grid._editIndexes[0] >= 0) {
                        alert("Cannot delete while editing a record.");
                        args.set_cancel(true);
                    }
                    else
                        var value = confirm("Are you sure you want to delete?");
                    if (!value)
                        args.set_cancel(true);
                }
            }
        </script>
    </telerik:RadCodeBlock>
    <div>
        <telerik:RadGrid ID="dgTest" runat="server" AutoGenerateColumns="False" GridLines="None"
            OnItemCommand="dgTest_ItemCommand" OnNeedDataSource="dgTest_NeedDataSource">
            <ClientSettings>
                <ClientEvents OnCommand="OnGridCommand" />
            </ClientSettings>
            <MasterTableView>
                <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </RowIndicatorColumn>
                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                    <HeaderStyle Width="20px"></HeaderStyle>
                </ExpandCollapseColumn>
                <Columns>
                    <telerik:GridBoundColumn DataField="Description" FilterControlAltText="Filter colDesc column"
                        HeaderText="Description" UniqueName="colDesc">
                    </telerik:GridBoundColumn>
                    <telerik:GridButtonColumn ButtonType="PushButton" CommandName="TestClick" FilterControlAltText="Filter colButt column"
                        Text="Press Me" UniqueName="colButt">
                    </telerik:GridButtonColumn>
                </Columns>
                <EditFormSettings>
                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                    </EditColumn>
                </EditFormSettings>
            </MasterTableView>
            <FilterMenu EnableImageSprites="False">
            </FilterMenu>
            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
            </HeaderContextMenu>
        </telerik:RadGrid>
    </div>
    <asp:Label ID="lblFeedback" runat="server"></asp:Label>
    <telerik:RadAjaxManager runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="dgTest">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="dgTest" />
                    <telerik:AjaxUpdatedControl ControlID="lblFeedback" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    </form>
</body>
</html>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
  
using System.Data;
using Telerik.Web.UI;
  
namespace TestTelerikWebApp
{
    public partial class GridButtonIndex : System.Web.UI.Page
    {
        protected DataTable GetData()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("Id", typeof(int));
            dt.Columns.Add("Description", typeof(string));
            DataRow dr = dt.NewRow();
            dr["Id"] = 1;
            dr["Description"] = "Test 1";
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["Id"] = 2;
            dr["Description"] = "Test 2";
            dt.Rows.Add(dr);
            dr = dt.NewRow();
            dr["Id"] = 3;
            dr["Description"] = "Test 3";
            dt.Rows.Add(dr);
  
            return dt;
        }
  
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                  
            }
        }
  
        protected void dgTest_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            RadGrid rg = (RadGrid)sender;
            rg.DataSource = GetData();
        }
  
        protected void dgTest_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (e.CommandName == "TestClick")
            {
                GridEditableItem gei = (GridEditableItem)(e.Item);
                lblFeedback.Text = "Item Index is : " + gei.ItemIndex.ToString();
            }
        }
    }
}


I am using the latest Telerik release with ASP.Net 40 (2010.3.1215.40).

Thanks for any insight.
Steele.
Steele
Top achievements
Rank 1
 answered on 17 Jan 2011
0 answers
97 views
Hi,
I asked this question on an old post that I do not know if it is still being monitored so I created a new thread...

I have created the two listboxes (like in example:"ListBox / Database Update") and couldn't get them to save to the DB on transfer because it was not capturing the ID. I had to change the parameter to grab the .SelectedValue of the Outgoing list box in order to get the items to insert into the db. Problem is when I do that and I choose the "move all" button it inserts the same value several times. I'll include the code for both examples. Just so you understand I have the listbox on the left (lstLoggedInUserAccess) pulling in all of the Stores that the Logged In user has access to. There is a combo box (cboUserDealerAcces) that the user selects a list of other users. The Logged In user then will give access to the selected user (of the cboUserDealerAcces combo box) by copying the stores from the left List to the Right list (lstSelectedUserAccess).

This code is what I have resorted to in order to get it to save to the database... but again, when I select the move all button it (understandably) inserts the same store several times because i have only captured one DealerID. I understand this but in this scenario would like to disable the 'move all' buttons. OR, The best option would be to get the lists working correctly where I could select several from the left and move them all to the right but until I'm able to capture the "DealerID" this is not an option.
 

<telerik:RadComboBox ID="cboUserDealerAccess" runat="server"
    DataSourceID="SqlDataSource6"
    DataTextField="LastName"
    DataValueField="UserInfoID" /> 
<asp:SqlDataSource runat="server" ID="SqlDataSource6" ConnectionString="<%$ ConnectionStrings:FT_Data %>"
    ProviderName="System.Data.SqlClient" SelectCommand="SELECT [LastName], [UserInfoID] FROM [UserInfo] ORDER By LastName" />   

 

<telerik:RadListBox runat="server" ID="lstLoggedInUserAccess" Height="200px" Width="230px"
    AllowTransfer="true" TransferToID="lstSelectedUserAccess" TransferMode="Copy" SelectionMode="Single" DataSourceID="SqlDataSource5" DataTextField="DealerName" DataKeyField="DealerID" DataValueField="DealerID" AutoPostBackOnTransfer="true"/>

 

<asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:FT_Data %>" ProviderName="System.Data.SqlClient"
SelectCommand="SELECT [DealerID], [DealerName] FROM [Dealer] ORDER By DealerName" OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues" />  

 

<telerik:RadListBox runat="server" ID="lstSelectedUserAccess" Height="200px" Width="200px"
SelectionMode="Single" DataSourceID="SqlDataSource7" DataKeyField="DealerID" DataTextField="DealerName" DataValueField="DealerID" AllowAutomaticUpdates="true" AllowReorder="false" AllowDelete="True" 
AutoPostBackOnDelete="true" AllowTransfer="false"/> 

 

<asp:SqlDataSource ID="SqlDataSource7" runat="server" ConnectionString="<%$ ConnectionStrings:FT_Data %>" ProviderName="System.Data.SqlClient" 
SelectCommand="SELECT [Dealer].[DealerID], [Dealer].[DealerName] FROM [UserDealer] INNER JOIN [Dealer] ON [UserDealer].[DealerId] = [Dealer].[DealerID] WHERE ([UserDealer].[UserInfoId] = @UserInfoID)"
InsertCommand="INSERT INTO [UserDealer] ([UserInfoID], [DealerID]) VALUES (@UserInfoID, @DealerID)" 
DeleteCommand="DELETE FROM [UserDealer] WHERE (UserInfoId = @UserInfoID and DealerId = @DealerID)" 
OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues" >  

 

 

<DeleteParameters>
<asp:ControlParameter Name="DealerID" Type="Int32" ControlID="lstSelectedUserAccess" PropertyName="SelectedValue" />      <asp:ControlParameter Name="UserInfoID" DbType="Int32" ControlID="cboUserDealerAccess" PropertyName="SelectedValue"/> 
</DeleteParameters 

 

<InsertParameters>
<asp:ControlParameter Name="DealerID" Type="Int32" ControlID="lstLoggedInUserAccess" PropertyName="SelectedValue" />
<asp:ControlParameter Name="UserInfoID" DbType="Int32" ControlID="cboUserDealerAccess" PropertyName="SelectedValue"/>
</InsertParameters 

 

<SelectParameters>
<asp:ControlParameter Name="UserInfoID" DbType="Int32" ControlID="cboUserDealerAccess" PropertyName="SelectedValue"/>
</SelectParameters>  

 

 

</asp:SqlDataSource>

When I change the INSERT parameter to this (see below) then it comes back empty and gives an error "Cannot Insert a Null..."

<asp:Parameter Name="DealerID" Type="Int32"/>

Marc
Top achievements
Rank 1
 asked on 16 Jan 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?