Telerik Forums
UI for ASP.NET AJAX Forum
9 answers
433 views
I am using Master pages in my asp.net Application. I want to set the focus to textbox control  in one  of my asp.net page(i.e Content page) loading in rad window.


I am using Radwindow to load my Asp.net pages.
Georgi Tunev
Telerik team
 answered on 08 Oct 2008
5 answers
58 views
I have made a user control having a grid and context menu having target set to grid. the grid is bound with some data. And the user control is dropped on the main page. it goes fine. But when the context menu pops up by clicking the grid control, it distrubs the whole layout and the grid drops down.

can anybody tel me how to make the context menu fixed so that it appears and does not disturb the layout.
Atanas Korchev
Telerik team
 answered on 08 Oct 2008
2 answers
106 views
Hi

I have a grid with the "slider" pager style and when the grid is rendered, the slider appears above the last row ? Someone knows how i can avoid that thing ?

Thnaks in advance for your helps

Dominic
Top achievements
Rank 2
 answered on 08 Oct 2008
4 answers
100 views
According to the thread at http://www.telerik.com/community/forums/thread/b311D-hmktb.aspx the assertion that the SetFocusOnError issues were fixed in the "Q2 2008" release.

Here's the post.

 -------------
Hi Justin,

The problem has been addressed for Q1 2008 SP1 version labeled 2008.1.515.

Please, give the latest Q2 2008 "Futures" build a try. You can read more about it here.

Greetings,
Konstantin Petkov
the Telerik team
---------

However I am using Ver 2008.2.804.20 and can't get the focus to go to the controls that I have tried (text box, date picker). So, which controls does
SetFocusOnError work on and how do you get it to work?

           <telerik:RadTextBox ID="State" runat="server" TabIndex="5" >
                    <FocusedStyle BackColor="#F1F6FC" />
                </telerik:RadTextBox>
 
                          <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
                              ControlToValidate="State" Display="Dynamic" SetFocusOnError="True">Required 
                          </asp:RequiredFieldValidator>

Or
                      <telerik:RadDatePicker ID="rdpStartDate" runat="server"  DateInput-FocusedStyle-BackColor="#F1F6FC" ToolTip="Select Start Date" CssClass="inline"></telerik:RadDatePicker>
                     <asp:RequiredFieldValidator id="rfvStartDate" runat="server"
                     text="* Required" controltovalidate="rdpStartDate" validationgroup="validate"
                     initalvalue="" CssClass="inline" ErrorMessage="Required"
                     SetFocusOnError="True" ></asp:RequiredFieldValidator>
                     <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="rdpEndDate"
                    ControlToValidate="rdpStartDate" ErrorMessage="Start Date must be before End Date"
                    Operator="LessThan" SetFocusOnError="True" CssClass="block valCustom" ></asp:CompareValidator>

does not work for me.

I love your controls, but some times they are a pain.

Keith E.


Keith
Top achievements
Rank 1
 answered on 08 Oct 2008
3 answers
96 views

I would like to create a Hierachical grid programatically. According to Telerik manuals http://www.telerik.com/help/aspnet-ajax/grdprogrammaticcreation.html
im using the following code, The only code i changed is to replace datasourceid with datasource cause im using datasets to load data. and at the end im loading the grid to a panel3. Does anyone see what im doing wrong here?

 

 

protected void Page_Init(object sender, System.EventArgs e)

 

{

DefineGridStructure();

}

 

private void DefineGridStructure()

 

{

 

 

 

RadGrid grid = new RadGrid();

 

grid.ID =

"RadGrid1";

 

grid.DataSource = dsData2;

grid.Skin =

"Inox";

 

grid.Width =

Unit.Percentage(100);

 

grid.PageSize = 5;

grid.AllowPaging =

true;

 

grid.PagerStyle.Mode =

GridPagerMode.NextPrevAndNumeric;

 

grid.AutoGenerateColumns =

false;

 

 

//Add Location

 

grid.MasterTableView.PageSize = 15;

grid.MasterTableView.Width =

Unit.Percentage(100);

 

grid.MasterTableView.DataKeyNames =

new string[] { "LocationID" };

 

 

GridBoundColumn boundColumn = new GridBoundColumn();

 

boundColumn.DataField =

"LocationID";

 

boundColumn.HeaderText =

"LocationID";

 

grid.MasterTableView.Columns.Add(boundColumn);

boundColumn =

new GridBoundColumn();

 

boundColumn.DataField =

"Location";

 

boundColumn.HeaderText =

"Contact Name";

 

grid.MasterTableView.Columns.Add(boundColumn);

 

//Add Sublocation
ableView tableViewOrders = new GridTableView(grid);

 

tableViewOrders.DataSource = dsData;

tableViewOrders.Width =

Unit.Percentage(100);

 

 

GridRelationFields relationFields = new GridRelationFields();

 

relationFields.MasterKeyField =

"LocationID";

 

relationFields.DetailKeyField =

"ParentLocationID";

 

tableViewOrders.ParentTableRelation.Add(relationFields);

boundColumn =

new GridBoundColumn();

 

boundColumn.DataField =

"LocationID";

 

boundColumn.HeaderText =

"LocationID";

 

tableViewOrders.Columns.Add(boundColumn);

boundColumn =

new GridBoundColumn();

 

boundColumn.DataField =

"Location";

 

boundColumn.HeaderText =

"Location";

 

tableViewOrders.Columns.Add(boundColumn);

grid.MasterTableView.DetailTables.Add(tableViewOrders);

 

// Add the grid to the placeholder
this.Panel3.Controls.Add(grid);

 

}

Please note that i can design both the master table and the detailtable at design time and it works fine but i want to do it in code behind for flexibility and thats what is giving me problems.

Omlac
Top achievements
Rank 1
 answered on 08 Oct 2008
3 answers
240 views
Hi,

I am trying to open a window from a popup window.  But the window just opens up inside the other window.  What am I doing wrong wrong?

The first window is opened up like this:

<radW:RadWindowManager ID="rwm" runat="server">
  <Windows>
    <radW:RadWindow
      ID="rwCISLookup"
      Behavior="Close"
      Modal="true"
      Height="230px"
      Width="560px"
      runat="server" />
  </Windows>
</radW:RadWindowManager>

When I click on the wondow submit button, it opens the window inside this window.  I want this second window to be in front of the first window.

This is how the second window is called:

<radW:RadWindowManager ID="rwm" runat="server">
  <Windows>
    <radW:RadWindow
      ID="rwCISResults"
      Modal="true"
      Height="430px"
      OpenerElementId="<%# btnSearch.ClientID %>"
      OffsetElementId="<%# btnSearch.ClientID %>"
      Width="1000px"
      NavigateUrl="CISResults.aspx"
      runat="server" />
  </Windows>
</radW:RadWindowManager>

This needs to be done server side because I need to set a session variable in the first window.

Please can someone help?

Thanks
Brendan
Georgi Tunev
Telerik team
 answered on 08 Oct 2008
0 answers
108 views
Hi,

I have used a image rather then text in menu.

I want to show hover/hand sign on menu.

Like in Telerik site <Products | Services| > etc.

Products are not showing hover sign. in site itself.

I want to put hover on that menu (Products)

Please let me know where I have to change the CSS.

Thanks,
Narender Singh
Narender
Top achievements
Rank 1
 asked on 08 Oct 2008
0 answers
163 views

Do i need to change any code for creating dynamic dock


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Telerik.Web.UI;
using System.Collections.Generic;
using SocialTerrain.Web.Lob;
using SocialTerrain.Web.Lob.Entity;
using System.Web.Script.Serialization;
using System.Data.SqlClient;
using SocialTerrain.Web.Dal;
using System.Xml.Serialization;
using System.IO;

 

public partial class docking : System.Web.UI.Page
{
    STDocksMasterCollection stDocksMasterCollectionObj = new STDocksMasterCollection();
    STDocksMaster stDocksMasterObj = new STDocksMaster();
    STDocksMasterRoot stDocksMasterRootObj = new STDocksMasterRoot();
   

    private List<DockState> CurrentDockStates
    {
        get
        {
            //Store the info about the added docks in the session. For real life
            // applications we recommend using database or other storage medium
            // for persisting this information.

            List<DockState> _currentDockStates = new List<DockState>();

           _currentDockStates = (List<DockState>)Session["DockStates"];
            if (Object.Equals(_currentDockStates, null))
            {
                _currentDockStates = new List<DockState>();
               Session["DockStates"] = _currentDockStates;
            }
         
            return _currentDockStates;
        
        }
        set
        {
            Session["DockStates"] = value;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        //DroptDownWidget.Visible = false;

   
      
   }
    

        protected void Page_Init(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                Session["UserId"] = 62;
                int userId = int.Parse(Session["UserId"].ToString());
                STDocksMaster sTDocksMasterobj = stDocksMasterRootObj.GetDockState(userId);
                string dbDockState = sTDocksMasterobj.DocksState;
                if (dbDockState != null)
                {
                    object obj = null;
                    XmlSerializer xs = new XmlSerializer(typeof(List<DockState>));
                    obj = xs.Deserialize(new StringReader(dbDockState));
                    Session["DockStates"] = (List<DockState>)obj;
                }
               int available= stDocksMasterRootObj.CheckDocksUserAvailable(userId);
              if (sTDocksMasterobj.Status == false && Session["Status"] == null && available==1)
                {
                    CreateDynamicDock();
                    Session["Status"] = 1;
                }
            }
            //Recreate the docks in order to ensure their proper operation
            for (int i = 0; i < CurrentDockStates.Count; i++)
            {
                if (CurrentDockStates[i].Closed == false)
                {
                    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);
                    //Load the selected widget
                    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.
            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)
        {
            //Save the dock state in the session. This will enable us
            // to recreate the dock in the next Page_Init.
            Session["UserId"] = 62;
            int userId = int.Parse(Session["UserId"].ToString());
            //stDocksMasterRootObj.DeleteDocksUser(userId);
            XmlSerializer ser = new XmlSerializer(typeof(List<DockState>));
            System.IO.StringWriter writer = new System.IO.StringWriter();
            ser.Serialize(writer, this.RadDockLayout1.GetRegisteredDocksState());
            string vv = writer.ToString();
            stDocksMasterRootObj.InsertDocksUser(userId, vv);
            STDocksMaster sTDocksMasterobj = stDocksMasterRootObj.GetDockState(userId);
            string dbDockState = sTDocksMasterobj.DocksState;
            object obj = null;
            XmlSerializer xs = new XmlSerializer(typeof(List<DockState>));
            obj = xs.Deserialize(new StringReader(dbDockState));
            Session["DockStates"] = (List<DockState>)obj;
           //// CurrentDockStates = (List<DockState>)Session["DockStates"];

        }

     

        private RadDock CreateRadDockFromState(DockState state)
        {
            RadDock dock = new RadDock();
            dock.ID = string.Format("RadDock{0}", state.UniqueName);
            dock.ApplyState(state);
            dock.Command += new DockCommandEventHandler(dock_Command);
            dock.Commands.Add(new DockCloseCommand());
            dock.Commands.Add(new DockExpandCollapseCommand());

            return dock;
        }

        private RadDock CreateRadDock()
        {
          
            int docksCount = CurrentDockStates.Count;
         
            RadDock dock = new RadDock();
            dock.UniqueName = Guid.NewGuid().ToString();
            dock.ID = string.Format("RadDock{0}", dock.UniqueName);

            dock.Title = "";
          
            dock.Text = string.Format("Added at {0}", DateTime.Now);
            dock.Width = Unit.Pixel(300);
           // stDocksMasterRootObj.InsertDocksMaster(dock.UniqueName, true);

            dock.Commands.Add(new DockCloseCommand());
            dock.Commands.Add(new DockExpandCollapseCommand());
            dock.Command += new DockCommandEventHandler(dock_Command);
          
            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);
        }

        private void LoadWidget(RadDock dock)
        {
            if (string.IsNullOrEmpty(dock.Tag))
            {
                return;
            }
            Control widget = LoadControl(dock.Tag);
            dock.ContentContainer.Controls.Add(widget);
        }

        protected void ButtonAddDock_Click(object sender, EventArgs e)
        {
            string _zone;
            RadDock dock = CreateRadDock();
            //In order to optimize the execution speed we are adding the dock to a
            // hidden update panel and then register a script which will move it
            // to RadDockZone1 after the AJAX request completes. If you want to
            // dock the control in other zone, modify the script according your needs.
          

                UpdatePanel1.ContentTemplateContainer.Controls.Add(dock);

                int countzone1 = RadDockZone1.Docks.Count;
                int countzone2 = RadDockZone2.Docks.Count;
                if (countzone1 <= countzone2)
                {
                    _zone = "RadDockZone1";
                }
                else
                    _zone = "RadDockZone2";

            ScriptManager.RegisterStartupScript(
            dock,
            this.GetType(),
            "AddDock",
            string.Format(@"function _addDock() {{
                          Sys.Application.remove_load(_addDock);
                             $find('{1}').dock($find('{0}'));
                                $find('{0}').doPostBack('DockPositionChanged');}};
                          Sys.Application.add_load(_addDock);", dock.ClientID, _zone),
            true);

            //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);

            //Load the selected widget in the RadDock control
            //DroptDownWidget.Visible = true;
            dock.Tag = "Members/UserControl/DockUserControl.ascx";
           LoadWidget(dock);

        }

        protected void CreateDynamicDock()
        {

            RadDockZone1.Docks.Clear();
            RadDockZone2.Docks.Clear();
            STDocksMasterRoot sTDocksMasterRootObj = new STDocksMasterRoot();
            STDocksMasterCollection sTDocksMasterCollectionObj = sTDocksMasterRootObj.GetAllDocksName();
            string _zone;

            foreach (STDocksMaster dockName in sTDocksMasterCollectionObj)
            {
                RadDock dock = CreateRadDock();
                //In order to optimize the execution speed we are adding the dock to a
                // hidden update panel and then register a script which will move it
                // to RadDockZone1 after the AJAX request completes. If you want to
                // dock the control in other zone, modify the script according your needs.

                UpdatePanel3.ContentTemplateContainer.Controls.Add(dock);

                if (ViewState["i"] == null)
                {
                    ViewState["i"] = 1;
                    _zone = "RadDockZone1";
                }
                else
                {
                    ViewState.Remove("i");
                    _zone = "RadDockZone2";
                }
              

                ScriptManager.RegisterStartupScript(

              dock,
              this.GetType(),
              "AddDock" + dock.ClientID,
              string.Format(@"function _addDock() {{
                          Sys.Application.remove_load(_addDock);
                             $find('{1}').dock($find('{0}'));
                                $find('{0}').doPostBack('DockPositionChanged');}};
                          Sys.Application.add_load(_addDock);", dock.ClientID, _zone),
              true);

 

                //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);
                if (dockName.DocksName == "Blogs")
                {
                    dock.Tag = "Members/UserControl/BlogUserControl.ascx";
                    dock.Title = "Blogs";
                }
                if (dockName.DocksName == "Videos")
                {
                    dock.Tag = "Members/UserControl/VideoUserControl.ascx";
                    dock.Title = "Videos";
                }
                //Load the selected widget in the RadDock control
                //DroptDownWidget.Visible = true;

                LoadWidget(dock);

            }
        }

        protected void loadDefaultDock_Click(object sender, EventArgs e)
        {
            Session["UserId"] = 62;
            int userId = int.Parse(Session["UserId"].ToString());
            stDocksMasterRootObj.DeleteDocksUser(userId);
            //int countzone1 = RadDockZone1.Docks.Count;
            //int countzone2 = RadDockZone2.Docks.Count;
            //for (int i = countzone1 - 1; i > -1; i--)
            //{
            //    RadDockZone1.Docks.Remove(RadDockZone1.Docks[i]);
            //}
            //for (int j = countzone2 - 1; j > -1; j--)
            //{
            //    RadDockZone2.Docks.Remove(RadDockZone2.Docks[j]);
            //}
            RadDockZone1.Docks.Clear();
            RadDockZone2.Docks.Clear();
            STDocksMasterRoot sTDocksMasterRootObj = new STDocksMasterRoot();
            STDocksMasterCollection sTDocksMasterCollectionObj = sTDocksMasterRootObj.GetAllDocksName();
            string _zone;

            foreach (STDocksMaster dockName in sTDocksMasterCollectionObj)
            {
                RadDock dock = CreateRadDock();
                //In order to optimize the execution speed we are adding the dock to a
                // hidden update panel and then register a script which will move it
                // to RadDockZone1 after the AJAX request completes. If you want to
                // dock the control in other zone, modify the script according your needs.

                UpdatePanel2.ContentTemplateContainer.Controls.Add(dock);

                if (ViewState["i"] == null)
                {
                     ViewState["i"] = 1;
                    _zone = "RadDockZone1";
                }
                else
                {
                     ViewState.Remove("i");
                    _zone = "RadDockZone2";
                }
           
                ScriptManager.RegisterStartupScript(
                     //UpdatePanel1,
                     //typeof(RadDock),
                     //"DockIntoZone" + dock.ClientID,
              dock,
              this.GetType(),
              "AddDock" + dock.ClientID,
              string.Format(@"function _addDock() {{
                          Sys.Application.remove_load(_addDock);
                             $find('{1}').dock($find('{0}'));
                                $find('{0}').doPostBack('DockPositionChanged');}};
                          Sys.Application.add_load(_addDock);", dock.ClientID, _zone),
              true);

                //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);
                if (dockName.DocksName == "Blogs")
                {
                    dock.Tag = "Members/UserControl/BlogUserControl.ascx";
                    dock.Title = "Blogs";
                }
                if (dockName.DocksName == "Videos")
                {
                    dock.Tag = "Members/UserControl/VideoUserControl.ascx";
                    dock.Title = "Videos";
                }
                //Load the selected widget in the RadDock control
                //DroptDownWidget.Visible = true;

                LoadWidget(dock);

            }
        }
       
}

 

Dodi
Top achievements
Rank 1
 asked on 08 Oct 2008
2 answers
236 views
Hi,

I have a basic Problem.

On a RadGrid, i set up a GridTemplateColumn with an ImageButton Inside.

I want a click on my button display a RadTooltip permitting the user to edit a label.

I load a TextBox and a Button dynamically like this:

  protected void RadToolTipManagerComment_AjaxUpdate(object sender, ToolTipUpdateEventArgs e) 
  RadTextBox RTB_Comment = new RadTextBox(); 
  RTB_Comment.TextMode = InputMode.MultiLine; 
  RTB_Comment.ID = "RTBSAISIECOM"
  RTB_Comment.Width = 350
  RTB_Comment.EmptyMessage = "<Saisissez Votre Commentaire (optionnel)>"
 
 
   if (!e.Value.StartsWith("-1")) 
   { 
       RTB_Comment.Text = new SoinQuotidien(e.Value.Split('_')[0]).Commentaire; 
   } 
     
            
   e.UpdatePanel.ContentTemplateContainer.Controls.Add(RTB_Comment); 
 
 
   //Ajout du Bouton_Valider 
    
   Button Btn_ValiderComment = new Button(); 
   Btn_ValiderComment.ID = "Button_ValiderCom"
   Btn_ValiderComment.Text = "Valider"
   Btn_ValiderComment.CssClass = "button"
 
   Btn_ValiderComment.Click += new EventHandler(Btn_ValiderComment_Click); 
 
 
 
   e.UpdatePanel.ContentTemplateContainer.Controls.Add(RTB_Comment); 
   e.UpdatePanel.ContentTemplateContainer.Controls.Add(Btn_ValiderComment); 
 

Everything works fine first time i load the tootip, but after, every load of the tootlip is done with the data i loaded first time.

I think about an ajax render problem but i don't see my problem.

Thank you very much for your help.


Svetlina Anati
Telerik team
 answered on 08 Oct 2008
9 answers
184 views
Hi,

I found in the Live Demos under  Web Grid that there's a function of Edit Selected and Delete Selected. My aim was to create another function which  does Add Selected, so is there any way that i could do this?

Thanks.
Sebastian
Telerik team
 answered on 08 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?