Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
332 views

In a MVC view page, I set the data source of the Grid control.
 
I want to conditionally populate the cells based on the data in the server side of the view in C#. How do I populate it?
 
I used to do it in the ItemDataBound server side event. Is there any way I can loop throgh the datasource and declarativley define the ItemTemplate of the GridTemplateColumn? Please let me know how I can do conditional display in server side.

Thanks

Jon Wood
Top achievements
Rank 1
 answered on 19 May 2011
5 answers
94 views
I have two RadGrids that have selectable rows that popup RadWindows.  When the windows close, I refresh the RadGrids to apply changes made in the windows.  I do this by using fireCommand with a sort (at the time I created this kind of logic with another app, sort was the only command that seemed to work all the time to refresh).  It works fine if I just refresh one grid that way, but if I try to do two, neither refreshes.  Do I need to do something extra to get both grids to fire a command in the same javascript function?
Mike Dennis
Top achievements
Rank 1
 answered on 19 May 2011
0 answers
73 views
Hi,
I've been implementing a RadGrid  using LINQ.
I've been trying to update the grid using a popup WebUserControl with AutomaticUpdates.
I've found (after a lot of tribulation) that if, in the WebUserControl, the field IDs are not identical to the DataBinding field names, the grid updates will not work.
Using the attached Northwind sample (which does work!), if you change the textbox ID in the customers.ascx WebUserControl to anything other than CompanyName (which is the database bind field name), the grid update fails e.g.

 

 

<telerik:RadTextBox runat="server" ID="txtCompanyName" Text='<%#DataBinder.Eval(DataItem,"CompanyName") %>' Width="150px" TextMode="MultiLine"/>

 

instead of

 

 

<telerik:RadTextBox runat="server" ID="CompanyName" Text='<%#DataBinder.Eval(DataItem,"CompanyName") %>' Width="150px" TextMode="MultiLine"/>

 


This problem has taken me quiet a while to get to resolve, so i thought I would post the issue here for anyone else who's experiencing the same headache.
Thanks,
Vincent.
Vincent Russell
Top achievements
Rank 1
 asked on 19 May 2011
1 answer
107 views
There doesnt seem to be a way to hide a tab in the Ribbonbar? This would be a useful option to change options based on user access.
Helen
Telerik team
 answered on 19 May 2011
1 answer
256 views
Having a issue with getting the RadFileExplorer work with the example provided in
http://demos.telerik.com/aspnet-ajax/fileexplorer/examples/server-sideapi/dbfilebrowsercontentprovider/defaultcs.aspx

Following is the code used in my aspx file

<telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" Width="750px" Height="500px"
OnClientItemSelected="OnClientItemSelected"
            Skin="Sitefinity">
<Configuration ViewPaths="~/Root/Default/ViewPath" UploadPaths="~/Root/Default/UploadPath"
   DeletePaths="~/Root/Default/DeletePath"  />
</telerik:RadFileExplorer> I have the ViewPaths, UploadPaths and DeletePaths set up in my solution as in the attached file (fileupload.png). The table structure is modeled according to the Items table with the addition of column CreatedBy. Have the following record in the Items table ItemID:1 Name: Root ParentID: NULL MimeType: NULL IsDirectory: True Size: NULL Content: NULL upsize_ts: NULL CreatedBy: nmarker Question 1: With the above setup I am unable to upload documents, or create Directories. Check file screenshot2.png My requirement is every logged in user to my website will have their own file structure defined in the DB. Have modified DataServer.cs
 private DataTable Data
    {
...                 SqlDataAdapter adapter = new SqlDataAdapter("SELECT ItemID, [Name], ParentID, MimeType, IsDirectory, [Size]FROM rbItems where CreatedBy='" + clsUtility.getLoggedInUserName() + "' ORDER BY ItemID", Connection);
        ...
    }
public byte[] GetContent(string path)
    {
..         SqlCommand command = new SqlCommand("SELECT Content FROM rbItems WHERE ItemID = @ItemID AND CreatedBy = @CreatedBy", Connection);
        ...
    }

    public void CreateItem(string name, string path, string mimeType, bool isDirectory, long size, byte[] content)
    {
..         SqlCommand command =
            new SqlCommand(
                "INSERT INTO rbItems ([Name], ParentId, MimeType, IsDirectory, [Size], Content, CreatedBy) VALUES (@Name, @ParentId, @MimeType, @IsDirectory, @Size, @Content, @CreatedBy)", Connection);
        ...
        command.Parameters.Add(new SqlParameter("@CreatedBy"clsUtility.getLoggedInUserName()));
...     }
Question 2: Can all logged in users share the same physical folder structure? as in fileupload.png? or should each user have their own folder structure defined? Please advise.
Pero
Telerik team
 answered on 19 May 2011
2 answers
82 views
I am relatively new to AJAX design patterns. I have a grid which usually shows multiple pages, as a simple publication catalog.

Let's say the user navigates to page 5 using the standard control, and then clicks a templated column entry that contains a hyperlink to a publication detail page.

Using the browser's Back button returns to the same grid, same data, but resets to showing the first page of results. I think this is expected because the paging is done on the client and disappears once the page is left via the hyperlink.

I have set the scroll bars for the grid, and enabled maintain position options, so if I return to the page, the proper grid page is displayed.

So, is there a way to get these in sync? Note that I have set a fixed client scrolling size, enabled saving of viewstate, etc.

As a test, I have set the selected page index as an IIS session variable, and then reset the grid upon return, but this seems like a NON-best practice, if you know what I mean.

Also note that my question is not at all related to browser history with the Back button, as far as I can tell, that has no relevance here.
Tomica
Top achievements
Rank 2
 answered on 19 May 2011
1 answer
215 views
Hi

What I specifically want to do is access the parent element of a grid row, specifically the the tbody element.

I am attempting to do this with the following JQuery snipet inside a RadScriptBlock

var

 

 

gridRowParent = $(".rgRow").parent;

Is this even possible.

Next I want to get the height of the gridRowParent.

Any pointers greatly appreciated.

 

Tsvetina
Telerik team
 answered on 19 May 2011
7 answers
226 views
Hi,
I have code to show/hide detail tables inside rad grid in rdGrid_PreRender method. I have this code run on !IsPostback and handling expand/collapse inside ItemComand event handler.

        private void ShowHideQualifications(GridTableView tableView)
        {
            GridItem[] nestedViewItems = tableView.GetItems(GridItemType.NestedView);
            bool atleastOneTableExists = false;
            foreach (GridNestedViewItem nestedViewItem in nestedViewItems)
            {
                foreach (GridTableView nestedView in nestedViewItem.NestedTableViews)
                {
                    TableCell cell = nestedView.ParentItem["ExpandColumn"];
                    if (nestedView.Items.Count > 0)
                    {
                        atleastOneTableExists = true;
                    }
                    if (nestedView.Items.Count == 0)
                    {
                        cell.Controls[0].Visible = false;
                        nestedView.Visible = false;
                    }
                    cell.Controls[0].Visible = nestedViewItem.Visible = atleastOneTableExists;
                }
                atleastOneTableExists = false;
            }
        }

Now the issue is with paging. When I click on any other page, the grid is posting back and so the code in PreRender doesn't run to hide the detail tables. If I change the code to run always, it runs even when expand/collapse buttons are clicked.

How can I fix it? Any help is greatly appreciated.

Thanks,
BC.
Mira
Telerik team
 answered on 19 May 2011
1 answer
138 views
I have a radscheduler component on an asp.net page - connected to a sql server data source.  I have stored procedures for the select, add, update and delete procedures. 

On the 'select' stored procedure, if I DON'T set the default values for the begin and end dates, the stored procedure doesn't select any records.  How can I check the 'dates' that the radscheduler is displaying and then submit those dates to the 'select' stored procedure?  (Obvously, the select stored procedures requires a date range)

Thanks!
Richard
Top achievements
Rank 1
 answered on 19 May 2011
1 answer
178 views
Hi,

    i am using Rad grid and in side i am binding three columns (Start time,End time and Time Difference)
inside the Start time and End time columns i am using Rad Time Picker controls. and inside the Time difference column i am using label control . my question is when i am chaging time(start time or end time) i need to update the time difference in client side.
can you please tell me the solution for this

if possible send me a sample please

FYI: i have attached my grid screen shot please verify
Shinu
Top achievements
Rank 2
 answered on 19 May 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?