Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
1.0K+ views
Hi,

I'm a newbie to Telerik controls and i am having and issue with trying to bind to a object/datasource.

Every example i am seeing is binding to a datagrid but i do want this. I have a few controls on the page and nothing seem to have any property to set a datasource or datamember for data binding.

Can anyonje tell me how i can do this or point me to a resource that can show me?

thanks,
Stephen
Shinu
Top achievements
Rank 2
 answered on 23 Apr 2013
5 answers
452 views
I have several RadGrids on a page which are reading data using a stored procedure.The autogeneratecolumns is set to true.
I am adding some controls to the rows dynamically on ItemDataBound. When I do a Sort/Filter on a RadGrid, that grid is rendering properly, but the other grids are losing the dynamically added controls.

I tried using the advanced databinding using the NeedDataSource and also doing a simple bind on every postback. It fails in both the scenarios.

   protected void myRadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
                   
     if (e.Item is GridDataItem)
                {
                    GridDataItem item = (GridDataItem)e.Item;
                    foreach (string hlc in hyperlinksColumns)
                    {
                        HyperLink link = new HyperLink();
                        Guid guid = new Guid();
                        link.ID = guid.ToString();
                        link.Text = item[hlc].Text; //accessing the GridBoundColumn to get the text
                        link.NavigateUrl = item[hlc + "_URL"].Text;
                        item[hlc].Controls.Add(link);
                    }
 
                    foreach (string ic in imageColumns)
                    {
                        Image image = new Image();
                        Guid guid = new Guid();
                        image.ID = guid.ToString();
                        image.ImageUrl = ImageLocation + item[ic + "_IMG"].Text;
                        item[ic + "_IMG"].Controls.Add(image);
                    }
 
 
                }
 
}

Jayesh Goyani
Top achievements
Rank 2
 answered on 22 Apr 2013
1 answer
206 views
Hi All,

   I have a RadPane inside the RadSplitter control. I want to set the background image for the RadPane.
I tried to use cssclass, in which I set the background image, but it is not working. if I set the background color using cssClass, it is working fine.
Please help me to resolve this.

Thanks,

V. Raguraman.
Vessy
Telerik team
 answered on 22 Apr 2013
4 answers
129 views
Hello All,
        I created radscheduler in asp.net application, i bind the sql table values in to radscheduler. in month view for particular day i have more than 50 appointments there, so radscheduler only shows 5 appointments and they show more option, if i click the more option in month view it will throw the f is null or not an object error
       Could anyone face this issue before please reply me, i want to resolve this

Thanks.
Kate
Telerik team
 answered on 22 Apr 2013
52 answers
3.2K+ views
I am trying to change to the new AjaxManager and AjaxPanel and right off the bat I am getting the following error:

Source: System.Web
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Inner Exception: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Stack Trace: at System.Web.UI.ControlCollection.AddAt(Int32 index, Control child) at Telerik.Web.UI.RadAjaxControl.MoveUpdatePanel(Control initiator, Control updated) at Telerik.Web.UI.RadAjaxControl.PerformRender() at Telerik.Web.UI.RadAjaxControl.OnPageRender(HtmlTextWriter writer, Control page) at Telerik.Web.UI.RadAjaxControl.RenderPageInAjaxMode(HtmlTextWriter writer, Control page) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.Page.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Form:
Query String:
Target Site: Boolean HandleError(System.Exception)


All i have done is change the radA:RadAjaxPanel to telerik:RadAjaxPanel.  I also added the <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> tag to the top of the page.  I also put a ScriptManager on the page.  Is there something I missed?

Thanks,  Jason

Tim
Top achievements
Rank 1
 answered on 22 Apr 2013
2 answers
125 views
I've been unable to find an answer to what I would think should be a simple syntax question, but what's the difference between the following tags:  <%# .... %>  and <%= ..... %>?

My hunch is that the only difference is after which page function the data is retrieved; however, I'm not about this.
Winney
Top achievements
Rank 1
 answered on 22 Apr 2013
3 answers
154 views
I have several usercontrols that utilize many RadDock elements. These usercontrols are loaded as content for multiview pages.
This is an excerpt from my default.aspx
<telerik:RadMultiPage ID="radShifts" runat="server" BorderColor="Black" BorderStyle="Inset" BorderWidth="2px" SelectedIndex="0" Width="100%">
                <telerik:RadPageView ID="pvActiveShifts" runat="server">
                    <uc2:activeshifts runat="server" />
                </telerik:RadPageView>
                <telerik:RadPageView ID="pvActivePending" runat="server">
                    <uc2:activeshiftspending runat="server" />
                </telerik:RadPageView>
                <telerik:RadPageView ID="pvCancelledPending" runat="server">
                    <uc2:cancelledshiftspending ID="cancelledshiftspending" runat="server" />
                </telerik:RadPageView>
                <telerik:RadPageView ID="pvCancelledArchived" runat="server">
                    <uc2:cancelledshiftsarchived ID="cancelledshiftsarchived" runat="server" />
                </telerik:RadPageView>
</telerik:RadMultiPage>

This is a sample usercontrol for uc2:activeshifts (I removed all of the controls in the content template to save space). This exact control can be considered identical for the remaining usercontrols.
<telerik:RadDockLayout ID="dockLayout1" runat="server" >
    <telerik:RadDockZone ID="zone1" runat="server" Orientation="Vertical" BorderStyle="None" Skin="Black">
        <telerik:RadDock ID="dockActiveShiftsFilter" runat="server" Skin="Black" Width="100%" DefaultCommands="None" Title="Filter" DockMode="Docked">
            <ContentTemplate>
            </ContentTemplate>
        </telerik:RadDock>
        <telerik:RadDock ID="dockActiveShiftsFilled" runat="server" Skin="Black" 
            Width="100%" DefaultCommands="ExpandCollapse" Title="Shifts Filled" 
            DockMode="Docked">
            <ContentTemplate>
            </ContentTemplate>
        </telerik:RadDock>
        <telerik:RadDock ID="dockActiveShiftsAvailable" runat="server" Skin="Black" Width="100%"
            DefaultCommands="ExpandCollapse" Title="Shifts Available" 
            DockMode="Docked">
            <ContentTemplate>
            </ContentTemplate>
        </telerik:RadDock>
    </telerik:RadDockZone>
</telerik:RadDockLayout>

On each usercontrol, I have a button that refreshes the current multipageview, when I select the button to refresh the content, the other pageview docks are rearranged in order on the page.

Each usercontrol uses a different dockzone and docklayout, so the controls shouldn't be affecting them. Is there a way to prevent the other docks from rearranging on postback?
Keith
Top achievements
Rank 2
 answered on 22 Apr 2013
3 answers
67 views
When you select a document in the document manager, the preview panel populates and the Insert button enables.  If you then delete the selected document, the data in the preview panel remains, and the Insert button is still enabled.  If the user clicks Insert, then a link is created to the document that was just deleted.

Is there a way to reset the preview panel, after the document is deleted?

Thanks!
Dave
Vessy
Telerik team
 answered on 22 Apr 2013
4 answers
138 views
I have the following Setup

TabStrip 1
TabStrip 2

TabStrip A
TabStrip B

If I click on a Tab in TabStrip 1 I populete TabStrip A + B
If I click on a Tab in TabStrip 2 I populate TabStrip A + B 

Now when I click on a Tab off TabStrip A or B I need to know if TabStrip 1 or TabStrip 2 populated the Tabstrips A + B

---------------

Kind of  hard to explain.

Look here to understand: http://uebersetzung.gebetsanliegen.ch/en/verse/default.aspx

Left side bible books of Old Testament. If I click a book 1. Mose (Genesis) I populate TabStrip A with the available chapters and TabStrip B with the available verses in that chapter.

Right side bible books of the New Testament. If i click on book Matthäus (Mathew)  I populate TabStrip A with the available chapters and TabStrip B with the available verses in that chapter.

Now the problem is that when I click on a verse from TabStrip B - I need to know which TabStrip was used to populate (Old or New Testament)

I could have TabStrips C + D and show hide when either TabStrip 1 or 2 is clicked but would like to have simple.

Any idea how to have this done (all Ajax)

Markus
Kate
Telerik team
 answered on 22 Apr 2013
1 answer
121 views
hey Guys - i've got a bit of a head scratcher here. i've got a combobox on a grid. i bind it on item databind. if the box comes up empty - no problem - you just click and it'll go get the list and fires the server method: OnItemsRequested.

the weird part is - if the combobox has data in it - it doesn't fire the OnItemsRequested event, but i can clear out the contents and it fires just fine.
is there something i'm missing here? it's got to be something simple. i've included partial markup for the grid - the databind method & the combobox method.
any help is totally appreciated.
thanks
rik

RAD GRID MARKUP:::

 

<telerik:RadGrid ID="WorkOrderItemsRadGrid" runat="server" AllowPaging="true" AutoGenerateColumns="false"

                        Skin="WebBlue" PageSize="8" EnableTheming="false" AllowFilteringByColumn="false" AllowCustomPaging="false"

                        OnItemDataBound="WorkOrderItemsRadGrid_ItemDataBound" OnNeedDataSource="WorkOrderItemsRadGrid_NeedDataSource"

                        Width="100%" OnItemCreated="WorkOrderItemsRadGrid_ItemCreated" AllowMultiRowSelection="true">

                        <GroupingSettings CaseSensitive="false" />

                        <PagerStyle Mode="NextPrevAndNumeric" />

                        <MasterTableView DataKeyNames="WORKORDERNUMBER,LOCATIONID,WORKORDERID,WORKORDERDETAILID,WOTYPENAME,LASTUPDATED,RACKNUMBER,LASTUPDATEDBY,MATERIALTYPE,MATERIALTYPEID,MATERIALDESCRIPTION"

                         CommandItemSettings-ShowAddNewRecordButton="false" EditMode="PopUp" CommandItemDisplay="Top"

                        AllowSorting="true" CommandItemSettings-RefreshText="Refresh" CommandItemSettings-RefreshImageUrl="~/App_Themes/GOLD Main/ToolBar/refresh_16x16.gif" >

                            <HeaderStyle HorizontalAlign="Left" />

                            <Columns>

                                <telerik:GridTemplateColumn AllowFiltering="false" HeaderStyle-Width="100px" UniqueName="RackNumberColumn"

                                    ItemStyle-HorizontalAlign="Left" ItemStyle-Width="100px" HeaderText="Rack">

                                    <ItemTemplate>

                                        <telerik:RadComboBox ID="RackNumberGridComboBox" runat="server" Width="90px" Height="160px"

                                            Skin="WebBlue" EnableLoadOnDemand="true" AutoPostBack="true" OnItemsRequested="RackNumberGridComboBox_ItemsRequested"

                                            AllowCustomText="false" HighlightTemplatedItems="true" DataValueField="RACKID"

                                            DataTextField="RACKNUMBER" DropDownWidth="210px">

                                            <HeaderTemplate>

                                                <ul class="woCustomerDropDown" style="width: 180px;">

                                                    <li class="woCustomerCol" style="width: 120px;">Rack Number</li>

                                                    <li class="woCustomerCol" style="width: 60px;">Utilization</li>

                                                </ul>

                                            </HeaderTemplate>

                                            <ItemTemplate>

                                                <ul class="woCustomerDropDown" style="width: 180px;">

                                                    <li class="woCustomerCol" style="width: 120px;">

                                                        <%# DataBinder.Eval(Container.DataItem, "RACKNUMBER") %></li>

                                                    <li class="woCustomerCol" style="width: 60px;">

                                                        <%# DataBinder.Eval(Container.DataItem, "UTILIZATION") %></li>

                                                </ul>

                                            </ItemTemplate>

                                        </telerik:RadComboBox>

                                    </ItemTemplate>

                                </telerik:GridTemplateColumn>

                                <telerik:GridBoundColumn DataField="WORKORDERITEMDISPLAY" HeaderText="Work Order"

                                    HeaderStyle-Width="80px" FilterControlWidth="60px" />

                               

                            </Columns>

                        </MasterTableView>

                    </telerik:RadGrid>

RAD GRID DATABIND:

protected void WorkOrderItemsRadGrid_ItemDataBound(object sender, GridItemEventArgs e)

        {

            GridCommandItem cmndItem = (GridCommandItem)WorkOrderItemsRadGrid.MasterTableView.GetItems(GridItemType.CommandItem)[0];

            LinkButton btn = (LinkButton)cmndItem.FindControl("RebindGridButton");

            ((System.Web.UI.WebControls.TableCell)(btn.Parent)).HorizontalAlign = HorizontalAlign.Left;

 

            if (e.Item is GridDataItem)

            {

                GridDataItem boundItem = (GridDataItem)e.Item;

                string wonumber = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[boundItem.ItemIndex]["WORKORDERNUMBER"]);

                string woid = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[boundItem.ItemIndex]["WORKORDERID"]);

                string locationid = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[boundItem.ItemIndex]["LOCATIONID"]);

                string wodetailid = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[boundItem.ItemIndex]["WORKORDERDETAILID"]);

                string lastracknumber = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[boundItem.ItemIndex]["RACKNUMBER"]);

                string lastrackid = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[boundItem.ItemIndex]["RACKID"]);

                string lastupdate = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[boundItem.ItemIndex]["LASTUPDATED"]);

                string lastupdateby = Convert.ToString(boundItem.OwnerTableView.DataKeyValues[boundItem.ItemIndex]["LASTUPDATEDBY"]);

                int materialtypeid = Convert.ToInt32(boundItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["MATERIALTYPEID"]);

                string materialdesc = boundItem.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["MATERIALDESCRIPTION"].ToString();

 

                if (lastracknumber != "")

                {

             RadComboBox rackBox = boundItem.FindControl("RackNumberGridComboBox") as RadComboBox;

 

                    using (TruckingBC tbc = new TruckingBC())

                    {

rackBox.DataSource = tbc.GetRackNumbers(DivisionID,lastracknumber);

                          rackBox.DataBind();

                                            }

                }

 

        }

 

 

 

COMBO BOX ON GRID EVENTS:

 

 

protected void RackNumberGridComboBox_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)

        {

            RadComboBox comboBox = (RadComboBox)sender;

            using (TruckingBC tbc = new TruckingBC())

            {

                comboBox.DataSource = tbc.GetRackNumbers(DivisionID);

                comboBox.DataBind();

            }

        }

 

 

Hristo Valyavicharski
Telerik team
 answered on 22 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?