Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
227 views
Hello!

I have a question regarding programmatically created RadDock controls. I can't figure out how to wire them with server-side Command event. On creating RadDock custom controls are loaded and they do postback on click but they don't fire Command event. The problem is also that on postback custom control disappears so one more thing is how to avoid that behavior.

This is my code:

        private RadDock CreateRadDock()
        {
            int docksCount = CurrentDockStates.Count;
            int idTicket = Convert.ToInt32(rcbTicketi.SelectedValue);

            Ticket ticket = db.Ticket.SingleOrDefault(t => t.idTicket == idTicket);

            RadDock dock = new RadDock();
            dock.DockMode = DockMode.Docked;
            dock.UniqueName = Guid.NewGuid().ToString().Replace("-", "a");
            dock.ID = string.Format("RadDock{0}", dock.UniqueName);
            dock.Title = ticket.idNadredeniTicket + "-" + ticket.RedniBroj + " (" + ticket.Firma.Naziv + ")";
            dock.Text = ticket.Opis;
            dock.Width = Unit.Pixel(500);
            dock.Command += new DockCommandEventHandler(RadDock_Command);

            DockCommand close = new DockCommand();
            close.AutoPostBack = true;
            close.Text = "Zatvori incident";
            close.Name = "Zatvori";

            DockCloseCommand hide = new DockCloseCommand();
            close.AutoPostBack = true;
            close.Text = "Sakrij";

            dock.Commands.Add(hide);
            dock.Commands.Add(new DockExpandCollapseCommand());
            dock.Commands.Add(close);           

            return dock;
        }

        protected void RadDock_Command(object sender, Telerik.Web.UI.DockCommandEventArgs e)
        {
            string naziv = e.Command.Name;

            if (e.Command.Name == "Zatvori")
            {
                Response.Redirect("www.google.hr");
            }
            else if (e.Command.Name == "Close")
            {
                Response.Redirect(Request.RawUrl + "?id=1");
            }
        }


There is also one more thing that bothers me. How could I get the ID of the RadDock on fired event?

Regards,

Hrvoje
Slav
Telerik team
 answered on 14 Mar 2012
5 answers
146 views
2010.3.1109.40

I created a non recurring appointment on March 1 2011 with a start date and time of March 16 2011 at 11am.  After it was created it showed in the scheduler correctly as11am.  However, now that March 16th has come the appointment is shown in the scheduler as starting at noon (1hr ahead of what its suppose to start on).  In the database its stored as "2011-03-15 19:00:00.000", my server time zone is PST (Pacific Standard Time).  I have created my scheduler and data access as outlined here and have a load event as shown below.  Please advise on how to get my events to show properly, its much more than just this event and this is a problem in production right now. 

protected void RadScheduler1_Load(object sender, EventArgs e)
{
    TimeZone localZone = TimeZone.CurrentTimeZone;
    TimeSpan currentOffset = localZone.GetUtcOffset(DateTime.Today);
    this.RadScheduler1.TimeZoneOffset = currentOffset;
}

Peter
Telerik team
 answered on 14 Mar 2012
5 answers
377 views
I am trying to set the attributes of an edit hyperlink in a TreeList. When you click the edit hyperlink it will execute javascript to open a RadWindow. What I would like to do is to pass the "Req #" column value when you click the hyperlink. I thought the best way would be to write that value in the onclick attribute on each hyperlink created. Although I'm having trouble getting the associated "Req #" column value.

To make it easier to understand I have attached an image. Basically I want pass the "Req #" value to the RadWindow when the "view/edit" link is clicked. 

Below is my code:

ASPX

<telerik:RadAjaxLoadingPanel ID="replenishmentLoadingPanel" runat="server" Skin="Simple" />
        <telerik:RadTabStrip ID="replenishmentTabStrip" runat="server" Skin="Simple" MultiPageID="RadMultiPage2"
            SelectedIndex="0">
            <Tabs>
                <telerik:RadTab Text="Req">
                </telerik:RadTab>
                <telerik:RadTab Text="P.O.">
                </telerik:RadTab>
            </Tabs>
        </telerik:RadTabStrip>
        <telerik:RadMultiPage ID="RadMultiPage2" runat="server" SelectedIndex="0" >
            <telerik:RadPageView ID="replenishmentPageView1" runat="server">
                <telerik:RadTreeList ID="requisitionTreeList" runat="server" AutoGenerateColumns="false" AllowSorting="false" AllowPaging="false"
                  OnNeedDataSource="requistions_needdata" OnPreRender="replenishment_PreRender" OnItemCreated="requisitons_ItemCreated"
                  DataKeyNames="ID" ParentDataKeyNames="PID" ShowTreeLines="false" EditMode="PopUp" >
                    <Columns>
                        <telerik:TreeListEditCommandColumn ShowEditButton="false" AddRecordText="Add" HeaderStyle-Width="30px" />
                        <telerik:TreeListBoundColumn DataField="ID" Visible="false" />
                        <telerik:TreeListBoundColumn DataField="PID" Visible="false" />
                        <telerik:TreeListBoundColumn DataField="ReqNum" HeaderText="Req #" UniqueName="ReqNum" />
                        <telerik:TreeListBoundColumn DataField="PONumber" HeaderText="PO #" />
                        <telerik:TreeListBoundColumn DataField="ReqDateTime" HeaderText="Transmit Time" />
                        <telerik:TreeListTemplateColumn UniqueName="TemplateEditColumn">
                            <ItemTemplate>
                                <asp:HyperLink ID="EditLink" runat="server" Text="View/Edit" href="#" onclick="openRadWin();"></asp:HyperLink>
                            </ItemTemplate>
                        </telerik:TreeListTemplateColumn>
                    </Columns>
                </telerik:RadTreeList>
                 
            </telerik:RadPageView>
 
            <telerik:RadPageView ID="repenishmentPageView2" runat="server">
                <telerik:RadTreeList ID="purchaseorderTreeList" runat="server" AutoGenerateColumns="false" AllowSorting="false" AllowPaging="false"
                  OnNeedDataSource="purchaseOrders_needdata" DataKeyNames="ID" ParentDataKeyNames="PID" ShowTreeLines="false" EditMode="PopUp" >
                    <Columns>
                        <telerik:TreeListEditCommandColumn ShowEditButton="false" AddRecordText="Add" HeaderStyle-Width="50px" />
                        <telerik:TreeListBoundColumn DataField="ID" Visible="false" />
                        <telerik:TreeListBoundColumn DataField="PID" Visible="false" />
                        <telerik:TreeListBoundColumn DataField="PONumber" HeaderText="PO #" />
                        <telerik:TreeListBoundColumn DataField="ReqNum" HeaderText="Req #" />
                        <telerik:TreeListBoundColumn DataField="PODateTime" HeaderText="Transmit Time" />
                    </Columns>
                </telerik:RadTreeList>
            </telerik:RadPageView>
        </telerik:RadMultiPage>


C#

protected void requisitons_ItemCreated(object sender, TreeListItemCreatedEventArgs e)
       {
           if (e.Item is TreeListDataItem)
           {     
               HyperLink editLink = (HyperLink)e.Item.FindControl("EditLink");
               editLink.Attributes["href"] = "#";
               //editLink.Attributes["onclick"] = "openRadWin(" + value + ");";
           }
       }


William
Top achievements
Rank 1
 answered on 14 Mar 2012
2 answers
229 views
We are using  Telerik.Web.UI   v. 2009.3.1208.0.

When customErrors are ON all errors come back as "There was an error in the callback.s[]_$$_"

If customErrors are turned OFF all error come back with proper messages (what was thrown from server side)

Steps to reproduce.

1) On the server side handle NodeExpand  event from the Telerik.Web.UI.RadTreeView
2) Within the method that handles the NodeExapend thrown an exception with some text "This is the error"
3) Make sure your web.config had this line  <customErrors mode="On" defaultRedirect="~/Error/ErrorPage.aspx"  redirectMode="ResponseRewrite" />
4) Click on the node and you will get an alert text box with the following text:  "There was an error in the callback.s[]_$$_"


If customErrors are turned off alert text box comes back with the right text: "This is the error.s[]_$$_" 

Please, help!
Plamen
Telerik team
 answered on 14 Mar 2012
2 answers
55 views
I noticed few issues with the newer version which I havent encountered with all other versions,
 1. When I press 'Enter' key after typing userid and password in login form it doesnt postback.
 2. When I enter values in a numeric textbox, it shows the value next to the control rather than displaying in the textbox.[See attachement]

Please let me know if I am missing something. Thanks in advance.
Dipen
Top achievements
Rank 1
 answered on 14 Mar 2012
1 answer
115 views
Hi,

Is there a way of locking certain columns (ie enabled=false) easily with the standard HeaderContextMenu columns selector sub-menu? What I need is for certain columns to be always visible and allow others to be switched on and off as required - however I can't see an easy way to do this.

Any advice would be appreciated,

Thanks

Barry
Richard
Top achievements
Rank 1
 answered on 14 Mar 2012
7 answers
348 views
Trying to change the colour of the grid row during the client-side databind event:

                function OnGridRowDataBound(oGrid, args) { 
                    var dataItem = args.get_dataItem(); 
                    var status = dataItem.Attributes["Status"]; 
                    if (status == "Locked") { 
                        var rowElement = dataItem.get_element(); 
                        rowElement.style.backgroundColor = "red"
                    } 
                } 
 

Gives me dataItem.get_element() is not a function.

Can you let me know how I can do this?

thanks,
Steve
Pero
Telerik team
 answered on 14 Mar 2012
3 answers
391 views
I have below telrik grid. 

As I am populating my grid dynamically, I have made AutoGenerateColumn = true. In the column section under MasterTableView I have created two hyperlink (i.e. GridHyperLinkColumn). I want to execute a server side event when user clicks on that column (i.e. Just like onclick event for both hyperlink)



<telerik:RadGrid ID="gvInvoice" Width="98%" AllowPaging="true" AllowSorting="true" PageSize="100"
                                    runat="server" AutoGenerateColumns="true" CellSpacing="0" GridLines="None" Skin="Office2010Blue"
                                    OnPageIndexChanged="gvInvoice_PageIndexChanged"
                                    ShowFooter="True" Height="100%">
                                    <MasterTableView>
                                        <Columns>
                                          <telerik:GridHyperLinkColumn Text="Add Comments" UniqueName="Comments"  HeaderStyle-Width="120px" HeaderText="Comments" NavigateUrl="#"></telerik:GridHyperLinkColumn>
                                          <telerik:GridHyperLinkColumn Text="Add Documents" UniqueName="Documents" HeaderStyle-Width="120px" HeaderText="Document" NavigateUrl="#"></telerik:GridHyperLinkColumn>
                                        </Columns>
                                    </MasterTableView>
                                   
                                    <PagerStyle Mode="NextPrevAndNumeric" />
                                    <ClientSettings>
                                    <Scrolling AllowScroll="true" SaveScrollPosition="true" UseStaticHeaders="true" /></ClientSettings>
                                </telerik:RadGrid> 
Shinu
Top achievements
Rank 2
 answered on 14 Mar 2012
1 answer
105 views
Hi,
        I want to write code snippet mannually for rad grid's insert update delete oprations. I have usercontrol and in aspx page i have used sqldatasource, but I dont want to use atuomatic facility of rad grid. So I want to know how to do database oprations through code behind. What would be the commands or events I need to complete it.
Dose any one give me example to write all the things manully at codebehind file. I am using Sql server 2008. So i want to know how to write the code to perform the oprations. If possible please give me example.

Kindly help me as early as possible.
Princy
Top achievements
Rank 2
 answered on 14 Mar 2012
2 answers
103 views
I'm just getting into the Telerik Scheduler. On our advanced form, there is a Resource (named Client) that when the selected index changes on the dropdown, it shows an updated attribute in the disabled 'attribute' textbox.

Is there any way to do that easily without having to generate my own advanced form?

For clarity, if I changed my Client to John, I would have a value of 1 show up read-only, but when changing it to say, Sue, it would change to 4.

Plamen
Telerik team
 answered on 14 Mar 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?