Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
268 views

I have a grid and I am using an insert command to enter records to an underneath table.

How can I automatically insert a column value (for example user_id) to a column?

I have made this column read only so that the user enters some values but he doesn't see that user_id column.

I get the user_id using the following code :

 

string UserID; //globally declare the UserId   
    protected void RadGrid1_PreRender(object sender, EventArgs e)  
    {  
        MembershipUser myObject = Membership.GetUser();  
        UserID = myObject.ProviderUserKey.ToString();  
    } 
Simon
Top achievements
Rank 1
 answered on 28 Nov 2008
1 answer
84 views
I have few questions regarding usage of the client side OnColumnMooving..() events.
1.
I would like to cancel column moving event if certain condition occurred (using ReorderColumnsOnClient="true")
for example here is my js method that cancels the event for first 2 columns in the grid.
function ColumnMoving(sender, eventArgs)
{     
    if(eventArgs.get_gridColumn().get_element().cellIndex < 2)
    {
        eventArgs.set_cancel(true);
    }
}
But what i find is when an event is canceled once, it never fires again for any of the other column.

2. Is it possible to use this event when  ReorderColumnsOnClient is set to "false"?

3. How can I find out the destination index of the column that is being reordered(meaning where is it about to be moved)?

Thank you
Polina
Georgi Krustev
Telerik team
 answered on 28 Nov 2008
1 answer
106 views
Hi, I'm wondering if there is a way to generate Thumbnails from a PowerPoint or Excel file?  I have many MS Office documents, which I link to inside my SharePoint site, but it would be much nicer if I was able to use a graphical thumbnail image of the particular documents.  Thanks in advance for any help!
Sebastian
Telerik team
 answered on 28 Nov 2008
13 answers
667 views

Hi, we're getting the following error message intermittently - at least several times a day - in the file \Sitefinity\UserControls\Navigation\SitePanelbar.ascx.cs .  We have made a few customizations to the ItemDataBound method in the file, but we can't quite place what might be happening.  Can anyone help us figure out this issue?

Error Message

10/30/2008 1:29:31 PM [UNKNOWN]
************************************************************************************

Exception Type: System.ArgumentException

Message: An item with the same key has already been added.

Source: mscorlib

Stack Trace:
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at Telerik.Cms.Data.CmsPage.get_LanguageVersions()
   at Telerik.Cms.Web.CmsSiteMapProvider.GetChildNodes(SiteMapNode node)
   at System.Web.SiteMapNode.get_ChildNodes()
   at System.Web.UI.WebControls.SiteMapDataSource.GetNodes()
   at System.Web.UI.WebControls.SiteMapDataSource.GetTreeView(String viewPath)
   at System.Web.UI.WebControls.SiteMapDataSource.GetHierarchicalView(String viewPath)
   at System.Web.UI.HierarchicalDataSourceControl.System.Web.UI.IHierarchicalDataSource.GetHierarchicalView(String viewPath)
   at Telerik.RadPanelbarUtils.RadControlDataSource.System.Web.UI.IHierarchicalDataSource.GetHierarchicalView(String viewPath)
   at Telerik.WebControls.RadPanelbar.PerformDataBinding(IEnumerable data)
   at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
   at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
   at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
   at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
   at UserControls_SitemapPanelbar.Page_Load(Object sender, EventArgs e) in d:\share\webroot\cms\Sitefinity\UserControls\Navigation\SitePanelbar.ascx.cs:line 46
   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.AddedControl(Control control, Int32 index)
   at System.Web.UI.ControlCollection.Add(Control child)
   at Telerik.Cms.Web.InternalPage.CreateChildControls()
   at System.Web.UI.Control.EnsureChildControls()
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
------------------------------------------------------------------------------------

Here's the code for ItemDataBound:

public void RadPanelbar1_ItemDataBound(object sender, RadPanelbarEventArgs e)
    {
        CmsSiteMapNode node = e.Item.DataItem as CmsSiteMapNode;

        if (this.hideUrlForGroupPages)
        {
            if (node != null && node.CmsPage.PageType == CmsPageType.Group)
            {
                e.Item.NavigateUrl = "";
            }
        }
        if (node != null)
        {
            if (node.HasChildNodes)
            {
                e.Item.CssClass = "customFocus";
            }
        }
    }


Georgi
Telerik team
 answered on 28 Nov 2008
1 answer
175 views

Hi

I am using menu as a context menu on grid.

I am inserting a new menu item at runtime from JavaScript. My problem is that the Menu does not disappear after on click event of the newly created item. The click event puts a drop down list through javascript in one of the columns of selected row.

var childItem = new Telerik.Web.UI.RadMenuItem();

 

childItem.set_text(strOption);

childItem._click = AdjustOwner_LoadDropdown; // AdjustOwner_LoadDropdown is a function

menu.get_items().insert(2, childItem);

Am I missing setting some property?

Veselin Vasilev
Telerik team
 answered on 28 Nov 2008
1 answer
212 views
hi. I have an issue that I can't seem to work around. I have a panelbar (pb1) on main.ascx. within pb1 i have two user controls each holding a radgrid ctlr1, and ctrl2 , respectively rg1 and rg2. I need a method to rebind rg1 and rg2 at the same time. For some reason I can't reference controls within the panelbar? What I was hoping to do was put a button on main.ascx, and using ajax manager control the two grids that way. This does work if I put a rg1.mastertableview.rebind()  in the rg1_prerender event. the problem though is obvious that every time i call an action on the grid, it rebinds, so that mean I can't collapse any grouped items. 
I'm pretty rookie at this type of thing so apologies if this should be very basic. my code is below for a basic setup
PS: I want to use a button to initiate the call as I am clicking it from a radwindow javascript.
note: sample is
main.ascx
        <asp:Button ID="Button1" runat="server" Text="Button" /><br /> 
        <br /> 
        <telerik:radpanelbar id="RadPanelBar1" runat="server" width="100%">  
<CollapseAnimation Type="None" Duration="100"></CollapseAnimation> 
<Items> 
<telerik:RadPanelItem runat="server" Text="Root RadPanelItem1" Expanded="True"><Items> 
<telerik:RadPanelItem runat="server" Text="child"><ItemTemplate> 
   
   <telerik:RadAjaxPanel runat="server" ID="rap1" > 
         
            <uc1:ctrl1 ID="Ctrl1_1" runat="server" /> 
          
   </telerik:RadAjaxPanel> 
</ItemTemplate> 
</telerik:RadPanelItem> 
</Items> 
</telerik:RadPanelItem> 
</Items> 
 
<ExpandAnimation Type="None" Duration="100"></ExpandAnimation> 
</telerik:radpanelbar> 
      
    </div> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="Button1">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="Ctrl1_1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
 


ctrl1 .ascx
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" 
    GridLines="None" ShowStatusBar="True">  
    <MasterTableView DataKeyNames="testid" DataSourceID="SqlDataSource1">  
        <GroupByExpressions> 
        <telerik:GridGroupByExpression> 
        <SelectFields> 
        <telerik:GridGroupByField FieldName="fname" FieldAlias="fname" FormatString="" HeaderText="" /> 
        </SelectFields> 
        <GroupByFields> 
        <telerik:GridGroupByField FieldName="fname" FieldAlias="fname" FormatString="" HeaderText="" /> 
        </GroupByFields> 
        </telerik:GridGroupByExpression> 
        </GroupByExpressions> 
        <Columns> 
            <telerik:GridBoundColumn DataField="testid" DataType="System.Int32" HeaderText="testid" 
                ReadOnly="True" SortExpression="testid" UniqueName="testid">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="fname" HeaderText="fname" SortExpression="fname" 
                UniqueName="fname">  
            </telerik:GridBoundColumn> 
            <telerik:GridBoundColumn DataField="thedate" UniqueName="thedate" /> 
              
        </Columns> 
    </MasterTableView> 
    <FilterMenu EnableTheming="True">  
        <CollapseAnimation Duration="200" Type="OutQuint" /> 
    </FilterMenu> 
</telerik:RadGrid><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:4ConnectionString %>" 
    SelectCommand="SELECT  fname,testid,getdate() as thedate FROM [testtable]"></asp:SqlDataSource> 
 

ctrl1.ascx.vb

 

Protected Sub RadGrid1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender

 

RadGrid1.Rebind()

 

End Sub

 

Paul
Telerik team
 answered on 28 Nov 2008
1 answer
75 views
i have a tree view control, i have made EnableEmbeddedSkins="false" which makes the +- buttons not to show,
now i want  to expand the node while clicking on the image associated with the node.

i now the toggle function make it expand. But on clicking on the image which event is fired? want to know so that
i will expand the image in that event function.
Atanas Korchev
Telerik team
 answered on 28 Nov 2008
5 answers
159 views
Hi

I have two simple grids on web page.
When I try to call function like :

function Rebind()
{  
    tableView = $find("Grid1").get_masterTableView();
    tableView.rebind();
}

Grid1 going to rebind and show new dataSet.

But if I call :

function Rebind()
{  
    tableView = $find("Grid1").get_masterTableView();
    tableView.rebind();
    tableViewW = $find("Grid2").get_masterTableView();
    tableViewW.rebind();
}

... Grid1 and Grid2 do not show new dataSet. Shows information about update on it's status bar only. Why ??

Regards
Krzysztof
Iana Tsolova
Telerik team
 answered on 28 Nov 2008
3 answers
143 views
Hi,
i create my menu server-side (all with navigateurl).

I set my top level menu to be ClickToOpen=True, but i cant seem to make the top level menu close when i have selected a child menu.

It stays open and i have to click somewhere on the page to close it.

Is there any way (code or javascript) to close the top level menu when one of its child menus have been selected ??

Many Thanks
Mark
Veselin Vasilev
Telerik team
 answered on 28 Nov 2008
2 answers
98 views
i have a rad context menu with some items in it.
<telerik:RadContextMenu ID="RadContextMenu1" Runat="server" OnClientItemClicked="ClientItemClicked" >

i want to change the image url when some item is clicked in ClientItemClicked(sender, eventArgs).
but the following code does not work. plz help me setting the image url to null.  I gone through the provided api and help provided as in Add Remove Disable Items on ClientSide, but does not make it work. plz tel if i am doing some thing wrong. alert displays the url properly now i want to disable the url and commit the changes for server side persistance.


function ClientItemClicked(sender, eventArgs) {

                        var item = eventArgs.get_item();
                         alert(" item url is set" + item.get_imageUrl() );

                        item.trackChanges();
                        item.SetText(" some text ");
                        item.SetImageUrl("");
                        item.commitChanges();

                             
                    }
Atanas Korchev
Telerik team
 answered on 28 Nov 2008
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?