Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
61 views
Dear Telerik,

Help me. I am desperate. I need to have a very simple scheduler. It is almost the same as you have. But, I need 2 more properties, which are
public/private
and Description.

I was able to create templates and put a textbox and checkbox for those properties. I can even get the values in code in the formcreate event.
I can manually assign those property. But I don't know how to get those values on the update and insert.

Is there any way to pass those properties rather than doing it by modifying all those AdvancedForm.ascx, AdvancedEditForm.ascx and a bunch of other files? I also tried to do it. But just gave up, after having hundreds of errors:)

I also tried to use resources for that purpose. It looks like it will not work that way, if I understand it right.

Thank you.
Peter
Telerik team
 answered on 14 Oct 2008
5 answers
129 views
Love the controls but I want to style them myself.  The docs refer to the locations of the PSD files for editing but I have yet to locate them.  Could someone point me in the right direction?

Thanks
Peter
Telerik team
 answered on 14 Oct 2008
1 answer
121 views
Hello,

The table I want to edit contains an int column and I need to display a text value according a lookup table which contains int/text pairs.
This fit ideally with GridDropDownColumn but problem is that the lookup table is generated in code behind.
I tryed different options with RadGrid_ItemDatabound and playing with EditMode according online documentation status without total success: when no columns are in edit mode, my column stay empty (but I have values in the DataTable), when one column goes in editMode, I have a RadCombobox displayed with my values set from the datasource I set in the editor, and curiously all the rows following the edited one display now values  ? When I stop editing the columns come back to empty display.

Any help welcome
CS
Yavor
Telerik team
 answered on 14 Oct 2008
1 answer
122 views
Hi,

We are supporting 2 modes for a user to display the edit usercontrol,
firstly
 
<telerik:GridButtonColumn CommandName ="Edit" ButtonType="LinkButton" DataTextField="Title" HeaderText="Title" SortExpression="Title" UniqueName="Title"></telerik:GridButtonColumn>

and secondly by selecting the row via a checkbox 

<

 

telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderText="Select"></telerik:GridClientSelectColumn>

 

and clicking on a toolbar "Properties" button.

When clicking on the linkbutton column the ItemCommand fires but the following code in the toolbar button event does not cause the ItemCommand event to fire.

 

if (this.grid.SelectedIndexes.Count == 1)

 

{

 

string index = this.grid.SelectedIndexes[0];

 

 

this.grid.MasterTableView.Items[index].Edit = true;

 

 

this.grid.Rebind();

 

 

this.grid.MasterTableView.Items[index].Selected = true;

 

}

Basically the grid is bound to a readonly business object, the intention is to retrieve the ID value of the user selected row in the ItemCommand event and load a Read/Write business object which will be used to populated the controls in the usercontrol displayed by the grid during edit mode.

Any idea how I can achieve this?

Many thanks
Antony

Antony
Top achievements
Rank 1
 answered on 14 Oct 2008
1 answer
138 views
Hi everyone,
I have taken a look at the example code for the Excel type grid and its kind of what I need. http://www.telerik.com/community/code-library/submission/b311D-babbkh.aspx However there is only textboxes in the example.

Does anyone have a code snippet that I could take a look at that shows a dropdown list and binds it with some data?

2nd question how do I loop through the created fields and retrieve the values?

Thanks for your time!
Yavor
Telerik team
 answered on 14 Oct 2008
2 answers
188 views
HI,

Iam trying to create a Google like filtering in RadGrid.I used the sample specified by telerik in the following link
http://www.telerik.com/help/aspnet/grid/grdgooglelikefiltering.html

I used the the same class provided in the sample MyCustomFilteringColumn

I just tried by setting the Google filtering only for one column

When i execute the code the combo box is displaying but when i choose a value then on page reload it throws the following error

Sys.WebForms.PageRequestManagerServerErrorException: Failed to load viewstate. The control tree into whcih viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding cintrols dynamically, the comtrols added during a post-back must match the type and position of the controls added during the initial request.

Please see sample code

ASPX
------

<

telerik:RadGrid ID="radGridMarkets" runat="server" AllowPaging="True" AutoGenerateColumns="False"

 

GridLines="None" OnNeedDataSource="radGridMarkets_NeedDataSource" PageSize="100"

 

Skin="Office2007">

 

<AlternatingItemStyle BackColor="#EDEFF1" BorderColor="Blue" />

 

<ItemStyle BorderStyle="Solid" />

 

<PagerStyle AlwaysVisible="True" Mode="Advanced" Position="TopAndBottom" />

 

<ClientSettings>

 

<Selecting AllowRowSelect="true" />

 

</ClientSettings>

 

<MasterTableView AllowFilteringByColumn="true">

 

<RowIndicatorColumn>

 

<HeaderStyle Width="20px" />

 

</RowIndicatorColumn>

 

<ExpandCollapseColumn>

 

<HeaderStyle Width="20px" />

 

</ExpandCollapseColumn>

 

<Columns>

 

<telerik:GridBoundColumn DataField="Tag" HeaderText="Tag" UniqueName="_colTag">

 

</telerik:GridBoundColumn>

 

<telerik:GridBoundColumn

DataField="ShortDescription" HeaderText="Short Description"

 

UniqueName="_colMktShortDesc">

 

</telerik:GridBoundColumn>

 

<telerik:GridBoundColumn

DataField="LongDescription" HeaderText="Long Description"

 

UniqueName="_colMktLongDesc">

 

</telerik:GridBoundColumn>

 

<telerik:GridBoundColumn DataField="ExchngRateMarketTag" HeaderText="Exchange Rate Tag "

 

UniqueName="_colExchngRateMarketTag ">

 

</telerik:GridBoundColumn>

 

<telerik:GridBoundColumn DataField="ConvertLocalCurrency"

 

HeaderText="Convert Local Currency " UniqueName="_colMktConvertLocalCurrency ">

 

</telerik:GridBoundColumn>

 

<telerik:GridBoundColumn DataField="IndexConsolidation" HeaderText="Index Consolidation"

 

UniqueName="_colIndexConsolidation ">

 

</telerik:GridBoundColumn>

 

<telerik:GridBoundColumn DataField="MarketConsolidation" HeaderText="Market Consolidation"

 

UniqueName="_colMarketConsolidation">

 

</telerik:GridBoundColumn>

 

</Columns>

 

</MasterTableView>

 

<FilterMenu EnableTheming="True">

 

<CollapseAnimation Duration="200" Type="OutQuint" />

 

</FilterMenu>

 

<EditItemStyle BorderStyle="Solid" />

 

</telerik:RadGrid></telerik:RadPageView

 

MyCustomFilteringColumn Class File
----------------------------------------

#region

Google Filter template Column

 

 

public class MyCustomFilteringColumn : GridBoundColumn

 

{

 

private object listDataSource = null;

 

 

//RadGrid calls this method when it initializes the controls inside the filtering item cells

 

 

protected override void SetupFilterControls(TableCell cell)

 

{

 

base.SetupFilterControls(cell);

 

cell.Controls.RemoveAt(0);

 

RadComboBox list = new RadComboBox();

 

list.ID =

"list" + this.DataField;

 

list.AutoPostBack =

true;

 

list.EnableLoadOnDemand =

true;

 

list.MarkFirstMatch =

true;

 

list.ShowToggleImage =

false;

 

list.SelectedIndexChanged +=

new RadComboBoxSelectedIndexChangedEventHandler(list_SelectedIndexChanged);

 

cell.Controls.AddAt(0, list);

cell.Controls.RemoveAt(1);

list.Width = 100;

list.DataTextField =

this.DataField;

 

list.DataValueField =

this.DataField;

 

list.DataSource =

this.ListDataSource;

 

list.DataBind();

}

 

protected void list_SelectedIndexChanged(object sender, EventArgs e)

 

{

 

GridFilteringItem filterItem = (sender as DropDownList).NamingContainer as GridFilteringItem;

 

 

if (this.DataType == System.Type.GetType("System.Int32") ||

 

 

this.DataType == System.Type.GetType("System.Int16") ||

 

 

this.DataType == System.Type.GetType("System.Int64"))

 

{

filterItem.FireCommandEvent(

"Filter", new Pair("EqualTo", this.UniqueName));

 

}

 

else // treat everything else like a string

 

filterItem.FireCommandEvent(

"Filter", new Pair("Contains", this.UniqueName));

 

}

 

public object ListDataSource

 

{

 

get { return this.listDataSource; }

 

 

set { listDataSource = value; }

 

}

 

//RadGrid calls this method when the value should be set to the filtering input control(s)

 

 

protected override void SetCurrentFilterValueToControl(TableCell cell)

 

{

 

base.SetCurrentFilterValueToControl(cell);

 

 

RadComboBox list = (RadComboBox)cell.Controls[0];

 

 

if (this.CurrentFilterValue != string.Empty)

 

{

list.SelectedValue =

this.CurrentFilterValue;

 

}

}

 

//RadGrid calls this method to extract the filtering value from the filtering input control(s)

 

 

protected override string GetCurrentFilterValueFromControl(TableCell cell)

 

{

 

RadComboBox list = (RadComboBox)cell.Controls[0];

 

 

return list.SelectedValue;

 

}

 

protected override string GetFilterDataField()

 

{

 

return this.DataField;

 

}

}

#endregion

Code Behind:
----------------

//Add Google Filtering for Market Columns

radGridMarkets.MasterTableView.Columns.Clear();

 

GridBoundColumn col2 = new MyCustomFilteringColumn();

 

radGridMarkets.Columns.Add(col2);

col2.DataField =

"Tag";

 

col2.UniqueName = radGridMarkets.MasterTableView.Name +

"_colMktTag";

 

col2.HeaderText =

"Tag";

 

 

GridBoundColumn col3 = new GridBoundColumn();

 

radGridMarkets.Columns.Add(col3);

col3.DataField =

"ShortDescription";

 

col3.UniqueName = radGridMarkets.MasterTableView.Name +

"_colMktShortDescription";

 

col3.HeaderText =

"Short Description";

 

 

GridBoundColumn col4 = new GridBoundColumn();

 

radGridMarkets.Columns.Add(col4);

col4.DataField =

"LongDescription";

 

col4.UniqueName = radGridMarkets.MasterTableView.Name +

"_colMktLongDescription";

 

col4.HeaderText =

"Long Description";

 

 

GridBoundColumn col5 = new GridBoundColumn();

 

radGridMarkets.Columns.Add(col5);

col5.DataField =

"ExchngRateMarketTag";

 

col5.UniqueName = radGridMarkets.MasterTableView.Name +

"_colMktExchngRateMarketTag";

 

col5.HeaderText =

"Exchange Rate Tag";

 

 

GridBoundColumn col6 = new GridBoundColumn();

 

radGridMarkets.Columns.Add(col6);

col6.DataField =

"ConvertLocalCurrency";

 

col6.UniqueName = radGridMarkets.MasterTableView.Name +

"_colMktConvertLocalCurrency";

 

col6.HeaderText =

"Convert Local Currency";

 

 

GridBoundColumn col7 = new GridBoundColumn();

 

radGridMarkets.Columns.Add(col7);

col7.DataField =

"IndexConsolidation";

 

col7.UniqueName = radGridMarkets.MasterTableView.Name +

"_colMktIndexConsildation";

 

col7.HeaderText =

"Index Consolidation";

 

 

GridBoundColumn col8 = new GridBoundColumn();

 

radGridMarkets.Columns.Add(col8);

col8.DataField =

"MarketConsolidation";

 

col8.UniqueName = radGridMarkets.MasterTableView.Name +

"_colMktMarketConsolidation";

 

col8.HeaderText =

"Market Consolidation";

 




#region

RadMarkets Data Binding

 

 

protected void radGridMarkets_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

 

{

 

 

if (!e.IsFromDetailTable)

 

{

 

int dbId = (int)HttpContext.Current.Session["INSTR_ID"];

 

 

List<InstrMarket> _lstmarket = _presenter.PopulateMarketsData(dbId);

 

 

foreach (GridBoundColumn column in radGridMarkets.MasterTableView.Columns)

 

{

 

if (column is MyCustomFilteringColumn)

 

{

 

List<String> itemsList = new List<String>();

 

 

foreach (InstrMarket item in _lstmarket)

 

{

itemsList.Add(item.Tag);

}

(column

as MyCustomFilteringColumn).ListDataSource = _lstmarket;

 

 

}

}

radGridMarkets.DataSource = _lstmarket;

}

}

 

private void radGridMarkets_ColumnCreating(object sender, GridColumnCreatingEventArgs e)

 

{

 

if ((e.ColumnType == typeof(MyCustomFilteringColumn).Name))

 

{

e.Column =

new MyCustomFilteringColumn();

 

}

}

 

protected void radGridMarkets_ItemCommand(object source, GridCommandEventArgs e)

 

{

 

if ((e.CommandName == "Filter"))

 

{

 

foreach (GridColumn column in e.Item.OwnerTableView.Columns)

 

{

column.CurrentFilterValue =

string.Empty;

 

column.CurrentFilterFunction =

GridKnownFunction.NoFilter;

 

}

}

}

#endregion





Iana Tsolova
Telerik team
 answered on 14 Oct 2008
4 answers
138 views

I have a ASP.Net website, using Visual Studio 2008 and Telerik controls.

I am using a radGrid and Bind it to a dataset using the event NeedDataSource.

I have enabled Filtering and Sorting in the grid. Sorting works fine, but everytime I click on the filter button it gives me the following error:

Unable to cast object of type 'Telerik.Web.UI.RadGrid' to type 'Telerik.Web.UI.GridTableView'.

PLEASE advise, this is very important for us to be able to use the filtering.

Thanks,

Shirin
Daniel
Telerik team
 answered on 14 Oct 2008
1 answer
145 views

Hi, I have a database in which we collect some customer information for RMA's. I have it setup so that they can add multiple phone numbers and those numbers are displayed in a grid. The only problem is that when they go to add an RMA they either have to save the record and then enter in the phone numbers, or they insert the numbers without a valid FK. How can I enter the information to a grid and then on the form submit pull out this information and actually submit it with a valid ID?

 

Table layout.

RMA table
RmaId
DateEntered
etc etc.

RMAPhone Table
RmaPhoneId
RmaId
PhoneType
PhoneNumber
PhoneExtension

 I am using the Telerik RAD AJAX Grid. I think it would be best to add the row's via JavaScript and then on the main form save go behind and grab each row but I'm usure how to actually accomplish this.

Thank you!


Yavor
Telerik team
 answered on 14 Oct 2008
3 answers
126 views
I am trying to make my site fully AJAXified while still updating the querystring for search engine optimization purposes.

Here is what I am trying

ASPX.VB
    Private Sub RenderMenu()  
 
        AddStyleSheet("~/RadControls_CustomSkin/Menu.RadControls_CustomSkin.css")  
 
        Dim PagesDC As New Dal.icms_PagesDataContext()  
        Dim results = PagesDC.icms_Pages_GetPageMenu()  
 
        RadMenu1.Skin = "RadControls_CustomSkin" 
        RadMenu1.DataTextField = "MenuName" 
        RadMenu1.DataFieldID = "ID" 
        RadMenu1.DataFieldParentID = "ParentID" 
        RadMenu1.EnableEmbeddedSkins = False 
        RadMenu1.OnClientItemClicked = "SetID()" 
 
        RadMenu1.DataSource = results  
        RadMenu1.DataBind()  
 
    End Sub 
 
    Protected Sub RadMenu1_ItemClick(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadMenuEventArgs) Handles RadMenu1.ItemClick  
        Dim HiddenID As HiddenField = DirectCast(Me.FindControl("HiddenID"), HiddenField)  
    End Sub 'RenderMenu  
 
    Protected Sub RadMenu1_ItemDataBound(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadMenuEventArgs) Handles RadMenu1.ItemDataBound  
        e.Item.NavigateUrl = "#ID=" & CType(DataBinder.Eval(e.Item.DataItem, "ID"), String)  
    End Sub 'RadMenu1_ItemDataBound 


ASPX
    <script type="text/javascript">  
        function SetID()  
        {  
            document.getElementById('<%= HiddenID.ClientID %>').value = window.location.hash;  
        }  
    </script> 
 
 
 
    <asp:HiddenField ID="HiddenID" runat="server" /> 

The plan is to update the HiddenID via javascript and using RadAJAX in the RadMenu1_ItemClick event to poll the database and update an asp: Panel with the new DB information.

anyone have any thoughts?
Atanas Korchev
Telerik team
 answered on 14 Oct 2008
1 answer
180 views
Helloz everyone,

I have a RadGrid with Filters enabled that is binded to a DataSource.

I am using the NeedDataSource event to hook up RadGrid's DataSource.

I want to get the DataView object of the RadGrid content ( filtered or not ) to pass it to another method for manipulation.

Any suggestions would be highly appreciated.

Thanks.





Yavor
Telerik team
 answered on 14 Oct 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?