Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
67 views
Hello,


Problem in RadScheduler(Width) auto adjustment in any screen(Big And Small) and in IE/FireBox/Grome/Shafari.


We used 


script type="text/javascript">
    function resizeScheduler()   
                  {
                      var scheduler = $find('<%=RadScheduler1.ClientID %>');
                      scheduler.get_element().style.width = "100%";
                      scheduler.repaint();
                  }
</script> 
And also set width=100% in RadScheduler control


In C# code
RadScheduler1.Width = Unit.Percentage(100);
but it is not work.


please help me as soon as possible.




Thanks


Best Regards
Mutum Jiten Singh
Akhil Systems
Veronica
Telerik team
 answered on 22 Apr 2011
1 answer
38 views
Hello,
We Used the following javascript:

<script type="text/javascript">
    function resizeScheduler()   
                  {
                      var scheduler = $find('<%=RadScheduler1.ClientID %>');
                      scheduler.get_element().style.width = "100%";
                      scheduler.repaint();
                  }
</script>
And call in the scheduler control of onload event.

And also c# code,
RadScheduler1.Width = Unit.Pixel(800);
or
RadScheduler1.Width = Unit.Percentage(100);

But it is not work.

Problem in RadScheduler(Width) auto adjustmen in any screen(Big And Small) and in IE/FireBox/Grome/Shafari.

Please help me as soon as possible.

Thanks

Mutum JIten Singh
Akhil Systems
Veronica
Telerik team
 answered on 22 Apr 2011
3 answers
119 views
Hello, 

I am trying to use the example http://demos.telerik.com/aspnet-ajax/dock/examples/myportal/defaultcs.aspx on a masterpage. I have done some research and I think the error has to do with using the dock.ID instead of ClientID but not totally sure and am unsure of how to correct properly. Can anyone please give me a suggestion on how to correct he problem.

Thanks

(inside pageview)...
                    <asp:UpdatePanel runat="server" ID="UpdatePanel1" ChildrenAsTriggers="false" UpdateMode="Conditional">
                        <ContentTemplate>
                            <telerik:RadDockLayout runat="server" ID="RadDockLayout1" OnSaveDockLayout="RadDockLayout1_SaveDockLayout"
                                OnLoadDockLayout="RadDockLayout1_LoadDockLayout">
                                <telerik:RadDockZone runat="server" ID="RadDockZone1" Width="550" MinHeight="50"
                                    Style="float: left" UniqueName="Folder Zone 1">
                                </telerik:RadDockZone>
                                <telerik:RadDockZone runat="server" ID="RadDockZone2" Width="320" MinHeight="50"
                                    Style="float: left; background: #f5f4e8;" UniqueName="Folder Zone 2">
                                </telerik:RadDockZone>
                                <telerik:RadDockZone runat="server" ID="RadDockZone3" Width="880" MinHeight="50"
                                    Style="background: #d5f0fa; float: left;" UniqueName="Folder Zone 3">
                                </telerik:RadDockZone>
                                <div style="display: none">
                                    Hidden UpdatePanel, which is used to receive the new dock controls. We will move
                                    them with script to the desired initial dock zone.
                                    <asp:UpdatePanel runat="server" ID="UpdatePanel3">
                                        <Triggers>
                                            <asp:AsyncPostBackTrigger ControlID="ButtonAddDock" EventName="Click" />
                                        </Triggers>
                                    </asp:UpdatePanel>
                                </div>
                            </telerik:RadDockLayout>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="ButtonAddDock" EventName="Click" />
                        </Triggers>
                    </asp:UpdatePanel>
-----------------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Web.Script.Serialization;
using System.Text;
using System.Collections;
 
public partial class MBA_Folder : System.Web.UI.Page
{
    private const string cookiename = "__dockState";
 
    private List<DockState> GetDocks(string cookieName)
    {
        List<DockState> currentDocks = new List<DockState>();
 
        string dockState;
        JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
        HttpCookie positionsCookie = Request.Cookies[cookiename];
        if (!Object.Equals(positionsCookie, null))
        {
            dockState = positionsCookie.Value;
            string[] currentDockStates = dockState.Split(new Char[] { '|' });
            foreach (string stringState in currentDockStates)
            {
                if (stringState != string.Empty)
                {
                    DockState state = new DockState();
                    state = serializer.Deserialize<DockState>(stringState);
                    currentDocks.Add(state);
                }
            }
        }
 
        return currentDocks;
    }
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DropDownZone.DataBind();
        }
    }
 
    public ArrayList GetZones()
    {
        ArrayList zones = new ArrayList();
        zones.Add(RadDockZone1);
        zones.Add(RadDockZone2);
        zones.Add(RadDockZone3);
        return zones;
    }
 
    private RadDock CreateRadDockFromState(DockState state)
    {
        RadDock dock = new RadDock();
        dock.DockMode = DockMode.Docked;
        dock.ID = string.Format("RadDock{0}", state.UniqueName);
        dock.ApplyState(state);
        dock.Commands.Add(new DockCloseCommand());
        dock.Commands.Add(new DockExpandCollapseCommand());
 
        return dock;
    }
 
    private RadDock CreateRadDock()
    {
        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 = DroptDownWidget.SelectedItem.Text;
        dock.Text = string.Format("Added at {0}", DateTime.Now);
        dock.Width = Unit.Pixel(300);
 
 
        dock.Commands.Add(new DockCloseCommand());
        dock.Commands.Add(new DockExpandCollapseCommand());
 
        return dock;
    }
 
    //    void dock_Command(object sender, DockCommandEventArgs e)
    //    {
    //        if (e.Command.Name == "Close")
    //        {
    //            ScriptManager.RegisterStartupScript(
    //            UpdatePanel1,
    //            this.GetType(),
    //            "RemoveDock",
    //            string.Format(@"function _removeDock() {{
    //    Sys.Application.remove_load(_removeDock);
    //    $find('{0}').undock();
    //    $get('{1}').appendChild($get('{0}'));
    //    $find('{0}').doPostBack('DockPositionChanged');
    //}};
    //Sys.Application.add_load(_removeDock);", ((RadDock)sender).ClientID, UpdatePanel1.ClientID),
    //            true);
    //        }
    //    }
 
    private void CreateSaveStateTrigger(RadDock dock)
    {
        //Ensure that the RadDock control will initiate postback
        // when its position changes on the client or any of the commands is clicked.
        //Using the trigger we will "ajaxify" that postback.
        dock.AutoPostBack = true;
        dock.CommandsAutoPostBack = true;
 
        AsyncPostBackTrigger saveStateTrigger = new AsyncPostBackTrigger();
        saveStateTrigger.ControlID = dock.ID;
        saveStateTrigger.EventName = "DockPositionChanged";
        UpdatePanel1.Triggers.Add(saveStateTrigger);
 
        saveStateTrigger = new AsyncPostBackTrigger();
        saveStateTrigger.ControlID = dock.ID;
        saveStateTrigger.EventName = "Command";
        UpdatePanel1.Triggers.Add(saveStateTrigger);
    }
 
    protected void Page_Init(object sender, EventArgs e)
    {
 
        List<DockState> CurrentDockStates = GetDocks(cookiename);
        for (int i = 0; i < CurrentDockStates.Count; i++)
        {
            RadDock dock = CreateRadDockFromState(CurrentDockStates[i]);
            //We will just add the RadDock control to the RadDockLayout.
            // You could use any other control for that purpose, just ensure
            // that it is inside the RadDockLayout control.
            // The RadDockLayout control will automatically move the RadDock
            // controls to their corresponding zone in the LoadDockLayout
            // event (see below).
            RadDockLayout1.Controls.Add(dock);
            //We want to save the dock state every time a dock is moved.
            CreateSaveStateTrigger(dock);
            LoadWidget(dock);
        }
    }
 
    protected void RadDockLayout1_LoadDockLayout(object sender, DockLayoutEventArgs e)
    {
        //Populate the event args with the state information. The RadDockLayout control
        // will automatically move the docks according that information.
        List<DockState> CurrentDockStates = GetDocks(cookiename);
        foreach (DockState state in CurrentDockStates)
        {
            e.Positions[state.UniqueName] = state.DockZoneID;
            e.Indices[state.UniqueName] = state.Index;
        }
    }
 
    protected void RadDockLayout1_SaveDockLayout(object sender, DockLayoutEventArgs e)
    {
 
        string dockState;
 
        JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
        List<DockState> stateList = ((RadDockLayout)sender).GetRegisteredDocksState(true);
        StringBuilder serializedList = new StringBuilder();
        int i = 0;
        while (i < stateList.Count)
        {
            serializedList.Append(serializer.Serialize(stateList[i]));
            serializedList.Append("|");
            i++;
 
        }
 
        dockState = serializedList.ToString();
 
        HttpCookie positionsCookie = new HttpCookie(cookiename, dockState);
 
        //Ensure that the cookie will not expire soon
        positionsCookie.Expires = DateTime.Now.AddYears(1);
        Response.Cookies.Add(positionsCookie);
    }
 
    protected void ButtonAddDock_Click(object sender, EventArgs e)
    {
        RadDock dock = CreateRadDock();
        //find the target zone and add the new dock there
        RadDockZone dz = (RadDockZone)FindControl(DropDownZone.SelectedItem.Text);
        dz.Controls.Add(dock);
        CreateSaveStateTrigger(dock);
 
        //Load the selected widget in the RadDock control
        dock.Tag = DroptDownWidget.SelectedValue;
        LoadWidget(dock);
 
        //Right now the RadDock control is not docked. When we try to save its state
        // later, the DockZoneID will be empty. To workaround this problem we will
        // set the AutoPostBack property of the RadDock control to true and will
        // attach an AsyncPostBackTrigger for the DockPositionChanged client-side
        // event. This will initiate second AJAX request in order to save the state
        // AFTER the dock was docked in RadDockZone1.
        CreateSaveStateTrigger(dock);
    }
 
    private void LoadWidget(RadDock dock)
    {
        if (string.IsNullOrEmpty(dock.Tag))
        {
            return;
        }
        Control widget = LoadControl(dock.Tag);
        dock.ContentContainer.Controls.Add(widget);
    }
 
    protected void ButtonPostBack_Click(object sender, EventArgs e)
    {
        //normal postback
    }
    protected void ButtonClear_Click(object sender, EventArgs e)
    {
        //clear docks state from the session
        //CurrentDockStates.Clear();
        //_dockStateCleared = true;
    }
}
Pero
Telerik team
 answered on 22 Apr 2011
1 answer
113 views
Hello,
    I want to use captcha in my login page. I have username textbox and password textbox and loginbutton.
If the username or password was fail three times i want to show captcha image and then after tens time i want to disable user.
Any Suggestion?
Pero
Telerik team
 answered on 22 Apr 2011
1 answer
159 views
I am using RadCaptcha in a user control in an application form.  It contains many asp.net controls (ie textboxes, dropdownlists, and etc) that expanded the form from top to bottom result in a vertical scroll bar.  The RadCaptcha is placed at the bottom before the submit button.

Functionality wise, the RadCaptcha is working as expect but everytime I click the link to play the audio, the form would automatically scrolls to the top instead of staying at the bottom.  In contract, the Generate New Image would stay where it is after a new image is generated.  Is this the normal behavor of the control?  How do I prevent it from focus to the top of the form when playing the audio?

Regards,

Donny


===
This is how I added the RadCaptcha to the usercontrol:

 

protected void Page_Init(object sender, System.EventArgs e)
  
  
captcha = new Telerik.Web.UI.RadCaptcha();
  
captcha.ID = "captcha";
  
captcha.ErrorMessage = "The security code you entered did not match. Please try again.";
  
captcha.EnableRefreshImage = true;
  
captcha.CaptchaAudioLinkButtonText = "Play Audio Code";
  
captcha.CaptchaImage.EnableCaptchaAudio = true;
  
captcha.CaptchaImage.AudioFilesPath = Server.MapPath("/forms/RadCaptcha");
  
captcha.CaptchaImage.UseAudioFiles = true;
  
captcha.CaptchaTextBoxLabel = String.Empty;
  
captcha.Visible = true;
  
divCaptcha.Controls.Add(captcha);
  
}

 

 

 

 

Pero
Telerik team
 answered on 22 Apr 2011
4 answers
139 views
Hi!

I'm using a RadGrid with a manual code behind handler to save (update and insert) the data from the Grid Command.  However, I've been asked to additionally create a button at the bottom of the form which will duplicate (not replace) these functions as well to give users more confidence.  Doing it on the Command eventhandler is very easy, however I'm not sure how to perform the same functions outside of the handler.  Could you give me some advice/direction on this?

Thanks!
-P
Jayesh Goyani
Top achievements
Rank 2
 answered on 22 Apr 2011
2 answers
190 views
Hello,
In the Edit form, is there a way to change whether an item is visible in the edit form through code.  I know that you can set the property of the column to read only, but how would you do that in default.aspx.cs

Thank you.
Nguyen
Top achievements
Rank 1
 answered on 22 Apr 2011
1 answer
68 views
Hey,

I am reusing the exact example in the following telerik demo RadGrid with UC.
The one and only change I made is that I reload my Combobox from a database. Everything works fine when Editing an existing row, but when I hit the "Add new Record", the RadComboBox gets the same values twice. I tracked this in the debug mode, and the RadComboBox shows the correct items count, but when rendered in the page, it is X2.

here is the only code I changed from the above example, I am using 2010 Q3.

Private Sub Page_DataBinding(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DataBinding
 
      Me.CmDealer.Items.Clear()
      Me.CmDealer.AppendDataBoundItems = True
      Me.CmDealer.Items.Add(New ListItem("", "0"))
 
      Me.CmDealer.DataValueField = "ID"
      Me.CmDealer.DataTextField = "Name"
      Me.CmDealer.DataSource = DataManager.GetDealers()
      Me.CmDealer.DataBind()
 
      Dim dealer As Object = DataBinder.Eval(DataItem, "IDDEALER")
 
      If dealer.Equals(DBNull.Value) Then
          CmDealer.SelectedValue = 0
          Return
      End If
 
      CmDealer.SelectedValue = CInt(dealer)
      CmDealer.DataSource = Nothing
 
      ''''''''''''''''''''''
 
      Me.CmManager.Items.Clear()
      Me.CmManager.AppendDataBoundItems = True
      Me.CmManager.Items.Add(New ListItem("", "0"))
 
      Me.CmManager.DataValueField = "ID"
      Me.CmManager.DataTextField = "Name"
      Me.CmManager.DataSource = DataManager.GetManagers()
      Me.CmManager.DataBind()
 
      Dim manager As Object = DataBinder.Eval(DataItem, "IDMANAGER")
 
      If manager.Equals(DBNull.Value) Then
          CmManager.SelectedValue = 0
          Return
      End If
 
      CmManager.SelectedValue = CInt(manager)
      CmManager.DataSource = Nothing
 
  End Sub


What is wrong with my code?

Thanks in advance!
-Mahmoud
Mahmoud
Top achievements
Rank 1
 answered on 22 Apr 2011
2 answers
80 views
HI,
I have a RadComboBox as an EditItemTemplate field within FormView. That FormView is decorated using FormDecorator. That combobox is rendered totally weird (IE, Firefox) when DecoratedControls is set to GridFormDetailsViews. But, if FormView is not decorated it renders, of course, as it should. Any help?
asimptota
Top achievements
Rank 1
 answered on 21 Apr 2011
1 answer
363 views
Greetings,

We are dynamically creating a Menu using RadTreeView control and each node is binded with .aspx page. When a node is clicked, the whole page postbacks and redirects to the assigned .aspx page and the RadTreeView control(Menu) will be recreated. As the page postbacks, the selected node losts its focus and all the nodes are getting collapsed.

As per our requirement, We need to set the focus on the selected node and its parent node to be expanded, even if the page postbacks. Please help us on this.

We tried getting the selected node value on RadTreeView_NodeClick event and this event is not firing consistantly.

FYI, we are binding the RadTreeView control using LINQ on Page_Load event and below is the code for the same.
=======================

rtvMenu.Nodes.Clear();

rtvMenu.DataTextField =

 

"MENU_NAME";

 

 

rtvMenu.DataValueField =

 

"MENU_ID";

 

 

rtvMenu.DataFieldID =

 

"MENU_ID";

 

 

rtvMenu.DataFieldParentID =

 

"PARENT_MENU_ID";

 

 

rtvMenu.DataNavigateUrlField =

 

"LANDING_PAGE";

 

 

rtvMenu.DataSource = v_Menu;

 

rtvMenu.DataBind();

=======================

Nikolay Tsenkov
Telerik team
 answered on 21 Apr 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?