Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
229 views
Hi
My grid is getting populated with data from stored procedure which is returning me data in descending order over date. The grid gives expected data if i donot use the <sort Expression> but gives me ascending order if i do give this expression.
Another issue is if i use Allowautosort="true" in grid control it just sorts on page level not on whole data. i have 5 records per page but more then 1 page. The sorting is behaving appropriately for whole data.

please help
Thanks
Mona
Sebastian
Telerik team
 answered on 03 Nov 2008
1 answer
106 views
hi i am facing problem in RadGrid1_InsertCommand

i want to extracts the values entered by the user .
so i am using following code
GridEditableItem editedItem = e.Item as GridEditableItem; 
Hashtable newValues = new Hashtable(); 
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem); 

now the 'newvalues' contains 0 elements.
i checked  the editeditem.keyvalues. it shows this error msg 'editedItem.KeyValues' threw an exception of type 'System.ArgumentOutOfRangeException'

but when i use same code in RadGrid1_InsertCommand
it shows the excat values what i want.

my markup is as follows
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Video.ascx.cs" Inherits="Admin_Controls_Video" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True"  
    AllowAutomaticInserts="false" AllowAutomaticUpdates="false"  
    DataSourceID="SqlDataSource1" GridLines="None"  
    onitemdeleted="RadGrid1_ItemDeleted" oniteminserted="RadGrid1_ItemInserted"  
    onitemupdated="RadGrid1_ItemUpdated"  
    oninsertcommand="RadGrid1_InsertCommand"  
    onupdatecommand="RadGrid1_UpdateCommand"
<MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top"  
        DataKeyNames="Id,title,description,path,data" DataSourceID="SqlDataSource1"
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
    <Columns> 
        <telerik:GridBoundColumn DataField="Id" DataType="System.Int32" HeaderText="Id"  
            ReadOnly="True" SortExpression="Id" UniqueName="Id"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="title" HeaderText="title"  
            SortExpression="title" UniqueName="title"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="description" HeaderText="description"  
            SortExpression="description" UniqueName="description"
        </telerik:GridBoundColumn> 
        <telerik:GridTemplateColumn DataField="path" HeaderText="Screen Shot"  
            SortExpression="path" UniqueName="path"
            <EditItemTemplate> 
                <asp:TextBox ID="pathTextBox" runat="server" Text='<%# Bind("path") %>'></asp:TextBox> 
            </EditItemTemplate> 
            <ItemTemplate> 
                <asp:Image ID="Image1" runat="server" ImageUrl='<%# "~/Images/thumbs/" +Eval("path") %>' /> 
            </ItemTemplate> 
        </telerik:GridTemplateColumn> 
        <telerik:GridBoundColumn DataField="data" Display="False" HeaderText="data"  
            SortExpression="data" UniqueName="data"
        </telerik:GridBoundColumn> 
        <telerik:GridEditCommandColumn> 
        </telerik:GridEditCommandColumn> 
        <telerik:GridButtonColumn CommandName="Delete" Text="Delete"  
            UniqueName="column"
        </telerik:GridButtonColumn> 
    </Columns> 
    <EditFormSettings> 
        <EditColumn UniqueName="EditCommandColumn1"
        </EditColumn> 
    </EditFormSettings> 
</MasterTableView> 
 
<FilterMenu EnableTheming="True"
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</FilterMenu> 
</telerik:RadGrid> 
<asp:SqlDataSource ID="SqlDataSource1" runat="server"  
    ConnectionString="<%$ ConnectionStrings:ASPNETDBConnectionString1 %>"  
    DeleteCommand="DELETE FROM [Video] WHERE [Id] = @Id"  
    InsertCommand="INSERT INTO [Video] ([title], [description], [path], [data]) VALUES (@title, @description, @path, @data)"  
    ProviderName="<%$ ConnectionStrings:ASPNETDBConnectionString1.ProviderName %>"  
    SelectCommand="SELECT [Id], [title], [description], [path], [data] FROM [Video]"  
    UpdateCommand="UPDATE [Video] SET [title] = @title, [description] = @description, [path] = @path, [data] = @data WHERE [Id] = @Id"
    <DeleteParameters> 
        <asp:Parameter Name="Id" Type="Int32" /> 
    </DeleteParameters> 
    <InsertParameters> 
        <asp:Parameter Name="title" Type="String" /> 
        <asp:Parameter Name="description" Type="String" /> 
        <asp:Parameter Name="path" Type="String" /> 
        <asp:Parameter Name="data" Type="String" /> 
    </InsertParameters> 
    <UpdateParameters> 
        <asp:Parameter Name="title" Type="String" /> 
        <asp:Parameter Name="description" Type="String" /> 
        <asp:Parameter Name="path" Type="String" /> 
        <asp:Parameter Name="data" Type="String" /> 
        <asp:Parameter Name="Id" Type="Int32" /> 
    </UpdateParameters> 
</asp:SqlDataSource> 
 
i am using radcontrols ajax Q2
plz help urget thanks
Daniel
Telerik team
 answered on 03 Nov 2008
1 answer
109 views
I am getting a javascript error if I try to apply a Contains filter on a GridBoundColumn if the column contains nulls in the data source.  I have not overridden any of the filtering behavior, yet if I try to apply a Contains, Does Not Contain, Starts With, or Ends With filter I get an error in an anonymous javascript function on this line: 

_this._webRequest.completed(Sys.EventArgs.Empty);

Other filters work and these 4 filters work if there are no nulls in the datasource for that column.  Does anyone have any clues as to what is cuasing this?

Thanks,
Brent

Sebastian
Telerik team
 answered on 03 Nov 2008
1 answer
53 views
Hi, hope u all doing well,
well i have a requirment in which there is a teacher who gives its free working hours to the students and within that frame of hours lets suppose i say that i h

Master Table

PKID    Tutor ID           CourseID        StartingDateID
1          Hassan   Programming  3 Nov 2008

Detail Table
PKFKID     DetailPKID    StartTime    End Time   WeekDay
1               1                  3:00 pm     4:00pm    Monday
1               2                  7:00 pm     8:00pm    Monday
1               3                  1:00 pm     2:00pm    Tuesday
1               4                  11:00 am     12:00pm    Saturday

These are the tables, so i need to select the times on load of the schedular and make all other cells disable for week view and within that free time the student is able to save his appointments bnt a condition if the appoointment is already saved its not edited or delted by some other user


Peter
Telerik team
 answered on 03 Nov 2008
1 answer
84 views
All,

I am having trouble wrapping my head around the following concept:

Say I have several types of resources, including Widgets and Gadgets.
Say I carry inventory of 10 Widgets. Since I know the total Widget inventory and I know the number of Widgets reserved at the time slot selected, I would like to allow users to select quantity of 1 to available Widgets if any Widgets are available during the selected time slot.

Is there a way to capture the resource type selected so I can check available inventory to update the quantity drop combo?

How about a way to add a "Check Inventory" linkbutton or similar once the resource has been selected?

Thanks,
jax
Peter
Telerik team
 answered on 03 Nov 2008
7 answers
203 views

Hello!

I am trying to implement the similar to this
http://demos.telerik.com/ASPNET/prometheus/Dock/Examples/DynamicDocks/DefaultCS.aspx article functionality.

I also have 2 RadZones (the second is like a cart).

But the difference is:
instead of "Add Dock" i have "Search" button. So on its click I have to completely change (clear and add found items) the first RadZone and, possible some elements from the second one.

My current Search method is:


private void SearchSongs()
zoneSearch.Controls.Clear(); 

 

zoneSearch.Docks.Clear();

CurrentDockStates.Clear();

 

DataTable dt = <-- getting data

 

foreach (... dr in dt.Rows)

 

{

 

RadDock rd = new RadDock();

 

rd.UniqueName =

Guid.NewGuid().ToString();

 

rd.Text = dr.Title;

rd.Title = dr.Title;

rd.ID =

string.Format("RadDock{0}", rd.UniqueName);

 

rd.DockMode =

DockMode.Docked;

 

rd.Commands.Add(

new DockCloseCommand());

 

rd.Commands.Add(

new DockExpandCollapseCommand());

 

rd.Command +=

new DockCommandEventHandler(dock_Command);

 

CreateSaveStateTrigger(rd); //  <--   but here an exception occured. actually, inside the method here: UpdatePanel1.Triggers.Add(saveStateTrigger);

 

 

 

zoneSearch.Controls.Add(rd);

can you give me a clue how should I manage this situation?

and what should I do to add another button handler (for instance, search2Button).

I hope the provided code is enough. All the code similar to the sample's one and another commands connected to moving, closing etc Docks works ok. The only problem (and difference) is in Search button work.

Thank you and the best regards,
Boleslav

Obi-Wan Kenobi
Top achievements
Rank 1
 answered on 03 Nov 2008
2 answers
214 views
I have a need to make minor customizations to the filtering logic in RadGrid for my app. My needs are fairly simple: I have a particular column that's making use of the DataFormatString to display a user friendly representation of a float and I need to intercept the filter command on that column to reformat the user's input so that it matches the underlying datastore rather than the value presented in the GUI.

This sort of thing is very common. So much so that I'm shocked at how little support for it there is in the grid. According to the documentation (here), in order to accomplish this you must do the following:
  1. Subscribe to the ItemCommand event
  2. Determine whether or not the command being fired is a filter command
  3. Determine whether or not the filter command matches a given column
  4. If so, string parse the entire sql where clause used by the grid so that you can parse out the particular predicate you're interested in
  5. Then, string parse the predicate to access the given value you want to reformat
  6. Reformat that value and replace it in the where clause
  7. Store the reformatted where clause somewhere because you'll then have to...
  8. Subscribe to the NeedDataSource event
  9. Replace the grid's default FilterExpression with your custom version
This is very bad. Surely there's a less error prone way to accomplish this task. I expected to find a separate FilterExpression object for each column with members for FilterType and FilterValue which could then be modified on ItemCommand. Am I missing something?

-K



Rosen
Telerik team
 answered on 03 Nov 2008
1 answer
93 views
Hi. I usually use Trendosoft's Multiple-IE to test for IE6. I recently noticed that the RadComboBox does not work in IE6. refer: [http://demos.telerik.com/ASPNET/Prometheus/Combobox/Examples/PopulatingWithData/AutoCompleteSql/DefaultCS.aspx] using IE6.
Once the page is loaded, and when the dropdown arrow is clicked, there is a JavaScript error thrown: 'The download of the specified resource has failed'. Also, the dropdown does not appear, and basically the combobox does not work.
Could this just be an error with my version of the browser, or has anyone else with actual IE6 see this as well?
Rosi
Telerik team
 answered on 03 Nov 2008
1 answer
77 views
hi i am using radcontrols ajax 2008 Q2
i want to know a v. simple question

i am using radupload inside radgrid
now when i insert new row or update it and then sets upload file it uploads fine
and if fileexits then it renames it and then saves it

now i want to know that how to access that renamed filename in RadGrid1_UpdateCommand or RadGrid1_InsertCommand
if i use objRadUploadScreenShot.UploadedFiles[0].GetName() it gives the original file name not the renamed file name.

plz help me in this simple question.
urgent
thanks
Erjan Gavalji
Telerik team
 answered on 03 Nov 2008
2 answers
209 views
I am dynamically generating a RadTreeView, and bind it to a dynamically generated XmlDataSource.

I need to set different nodes to different ItemTemplates.

To do this, I databind the RadTreeView, so each node item is generated inside the RadTreeView.Nodes collection. Then, I foreach through the Nodes collection, and set each node's template to a certain template. If I do this, the data from the XML file is overwritten with the data in the template. But if I databind the RadTreeView again afterwards, each node's template is lost again.

Here's some code :

foreach'ing through the nodes
foreach (Telerik.Web.UI.RadTreeNode tn in CellTree.Nodes) 
      tn.Expanded = true
      tn.ExpandChildNodes(); 
      //Set header/item templates 
      SetItemTemplate(tn); 

setting the template :
private void SetItemTemplate(Telerik.Web.UI.RadTreeNode Node) 
   if (Node.ParentNode == null) 
   { 
       MyTemplate template = new MyTemplate("Header"); 
       template.InstantiateIn(Node); 
   } 
   else 
   { 
       MyTemplate template = new MyTemplate("Item"); 
       template.InstantiateIn(Node); 
   } 
 
   foreach (Telerik.Web.UI.RadTreeNode tn1 in Node.Nodes) 
   { 
       //Use reflection to set each child item's template 
       SetItemTemplate(tn1); 
   }             

The template class :
public class MyTemplate : System.Web.UI.ITemplate 
    string TemplateType; 
 
    public MyTemplate(string type) 
    { 
        TemplateType = type
    } 
 
    public void InstantiateIn(Control container) 
    { 
        PlaceHolder ph = new PlaceHolder(); 
        ph.ID = "test"
        Label label1 = new Label();             
 
        switch (TemplateType) 
        { 
            case "Header": 
                ph.Controls.Add(new LiteralControl("<div style=\"background-image:url(images/Parent.jpg); background-repeat:no-repeat; padding-left:15px; padding-top:4px; width:400px; height:31px\">")); 
 
                label1.ID = "MenuItem"
                label1.Text = "Text"
                label1.Font.Size = 10
                label1.Font.Bold = true
                label1.ForeColor = Color.White;                     
                ph.Controls.Add(label1); 
                ph.DataBinding += new EventHandler(ph_DataBinding); 
                ph.Controls.Add(new LiteralControl("</div>")); 
                break; 
 
            case "Item": 
                ph.Controls.Add(new LiteralControl("<div style=\"background-image:url(images/item.bmp); background-repeat:no-repeat; padding-left:10px; width:400px; height:24px\">")); 
                label1.ID = "MenuItem"
                label1.Text = "Text"
                label1.Font.Size = 10
                label1.Font.Bold = true
                ph.Controls.Add(label1); 
                ph.DataBinding += new EventHandler(ph_DataBinding); 
                ph.Controls.Add(new LiteralControl("</div>")); 
                break; 
        }             
        container.Controls.Add(ph); 
    } 
 
    private void ph_DataBinding(object sender, EventArgs e) 
    { 
        PlaceHolder ph = (PlaceHolder)sender; 
        Telerik.Web.UI.RadTreeNode ri = (Telerik.Web.UI.RadTreeNode)ph.NamingContainer; 
        string menutext = (string)DataBinder.Eval(ri.DataItem, "Text"); 
        ((Label)ph.FindControl("MenuItem")).Text = menutext
    } 

Is there another way of setting each node's template to a certain template?
Veselin Vasilev
Telerik team
 answered on 03 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?