Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
236 views
Hi,

I am creating a dynamic raddock  then storing into database.  When I do a postback  I am  not retreiving and displaying the raddock in saved BUT on a 2nd postback it is working ok.  The bigger problem is that if I run again it should pull from database and display raddock in zones that was last saved loads the raddock in the original position.   It seems that I am missing something in _init.  
I have reviewed on-line example and forums but  have not found anything to solve my problem.  

 

<table>

 

 

 

<tr><td><asp:button runat="server" id="Button1" text="save dashboard" />

 

 

 

<br/><br/></td></tr>

 

 

 

 

<telerik:raddocklayout runat="server" enableviewstate="false" id="RadDockLayout1" onloaddocklayout="RadDockLayout1_LoadDockLayout" Skin="Web20"

 

 

 

onsavedocklayout="RadDockLayout1_SaveDockLayout" storelayoutinviewstate="false" >

 

 

 

<tr>

 

 

 

 

<td valign="top">

 

 

 

 

 

 

 

<telerik:raddockzone runat="server" id="RadDockZone1" width="402px" min-height="200px">

 

 

 

 

</telerik:raddockzone>

 

 

 

</td>

 

 

 

<td valign="top">

 

 

 

<telerik:raddockzone runat="server" id="RadDockZone2" width="402px" min-height="200px">

 

 

 

</telerik:raddockzone>

 

 

 

</td></tr>

 

 

 

<tr><td colspan="2"><telerik:raddockzone runat="server" id="RadDockZone3" Width="820px" MinHeight="200px" >

 

 

 

 

</telerik:raddockzone></td></tr>

 

 

 

</table>

 

 

 

 

</telerik:raddocklayout>

 

 

 



 

private void Page_Load(object sender, System.EventArgs e)

 

{

 

}

 

 

 

private List<DockState> CurrentDockStates

 

{

 

 

get

 

 

{

 

//Get saved state string from the database - set it to dockState variable for example

 

 

 

string dockStatesFromDB = "";

 

 

 

string loginID = "xxx";

 

 

 

string loginPassword = "xxx";

 

 

 

using (XcendaDC1DataContext context = new XcendaDC1DataContext())

 

{

 

 

var users = from u in context.tbUsers

 

 

 

where (u.U_userLogin.Contains(loginID) && u.U_userPassword.Contains(loginPassword))

 

 

 

select u;

 

 

 

var x = users.FirstOrDefault();

 

 

 

if (x != null)

 

{

dockStatesFromDB = x.U_dockState;

 

}

}

 

 

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

 

 

 

string[] stringStates = dockStatesFromDB.Split('|');

 

 

 

foreach (string stringState in stringStates)

 

{

 

 

if (stringState.Trim() != string.Empty)

 

{

_currentDockStates.Add(

 

DockState.Deserialize(stringState));

 

}

}

 

 

return _currentDockStates;

 

}

}

 

 

 

 

protected void Page_Init(object sender, EventArgs e)

 

{

 

 

int docksCount = CurrentDockStates.Count;

 

 

 

// raddock1

 

 

 

RadDock raddock1 = new RadDock();

 

raddock1.ID =

 

string.Format("RadDock{0}", docksCount);

 

raddock1.Title =

 

"Products";

 

 

 

// raddock1.Text = string.Format("Added at {0}", DateTime.Now);

 

 

raddock1.UniqueName =

Guid.NewGuid().ToString();

 

raddock1.Width =

 

Unit.Pixel(300);

 

raddock1.Skin =

 

"Web20";

 

 

 

RadGrid gv = new RadGrid();

 

 

 

ArrayList arrListProducts = new ArrayList();

 

arrListProducts.Add(

 

"product 1");

 

arrListProducts.Add(

 

"product 2");

 

arrListProducts.Add(

 

"product 3");

 

arrListProducts.Add(

 

"product 4");

 

arrListProducts.Add(

 

"product 5");

 

arrListProducts.Add(

 

"product 6");

 

arrListProducts.Add(

 

"product 7");

 

gv.DataSource = arrListProducts;

gv.DataBind();

raddock1.ContentContainer.Controls.Add(gv);

raddock1.Commands.Add(

 

new DockCloseCommand());

 

raddock1.Commands.Add(

 

new DockExpandCollapseCommand());

 

 

RadDockZone1.Controls.Add(raddock1);

}

 

 

 

 

 

 

 

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)

 

{

 

 

List<DockState> stateList = RadDockLayout1.GetRegisteredDocksState();

 

 

 

StringBuilder serializedList = new StringBuilder();

 

 

 

int i = 0;

 

 

 

while (i < stateList.Count)

 

{

serializedList.Append(stateList[i].ToString());

serializedList.Append(

 

"|");

 

i++;

}

 

 

string dockState = serializedList.ToString();

 

 

 

if (dockState.Trim() != String.Empty)

 

{

 

 

string loginID = "myID";

 

 

 

string loginPassword = "myPassword";

 

 

 

using (XcendaDC1DataContext context = new XcendaDC1DataContext())

 

{

 

 

var users = from u in context.tbUsers

 

 

 

where (u.U_userLogin.Contains(loginID) && u.U_userPassword.Contains(loginPassword))

 

 

 

select u;

 

 

 

var x = users.FirstOrDefault();

 

 

 

if (x != null)

 

{

x.U_dockState = dockState;

context.SubmitChanges();

}

}

}

}

 

Slav
Telerik team
 answered on 14 Sep 2011
3 answers
136 views
I there.

I've a timetable in a WeekDay view. Depending on the information got from the datasource, sometimes I have more than 10 concurrent appointments for and sometimes I have only 1 or 3 appointments at the same time. In the case where I have 10 appointments I have to increase the radscheduler width but in cases I have only 1 or 3 appointments I don't want to change the width.

I don't if it is possible, but I want to in someway to resize automatically the radscheduler based in the number of appointments at the same time. 
For instance, in a weekview, if the maximum number of concurrent appointments is 2 then I would like to set the radsched width to 500px, if I have 5 concurrent appointments I would like set to 800px and if I have 10 concurrent appointments I'de like to set width to 1000px.

Is that possible? There is another approach for this problem?


Thanks




Ivana
Telerik team
 answered on 14 Sep 2011
1 answer
86 views
Hi Telerik Team,

Have you ever heard about __#!$Novalue$!#__?

One of our customers reported an error in their solution(using RTE). Sometimes when opening their content editor, the body content is missing and a __#!$Novalue$!#__  is displayed instead. See the screenshot( http://screencast.com/t/EoG3tRK2Y ).

Many thanks for your answer.

Best regards,
Anton.

Rumen
Telerik team
 answered on 14 Sep 2011
1 answer
45 views
Steps to reproduce :
  1. Open "Chrome" browser(I was not able to reproduce this behavior on IE and Firefox)
  2. Go to the  following link :"http://demos.telerik.com/aspnet-ajax/editor/examples/contentfilters/defaultcs.aspx"
  3. Select the "HTML" tab in editor 
  4. Paste following snippet into editor:  <div style="background-image: url(/~/image/picture.jpg);">text</div>
  5. Select the "Design" tab and then again select "HTML" tab

As a result you will have the following:
<DIV STYLE="BACKGROUND-IMAGE: URL(HTTP://DEMOS.TELERIK.COM/~/IMAGE/PICTURE.JPG);">TEXT</DIV>

Editor adds the host name to url.

Why after switching between tabs("Design" and "HTML") the host name was added to the url , and how can I prevent such a behavior? 
Rumen
Telerik team
 answered on 14 Sep 2011
1 answer
96 views
I'm using a radtextbox to Insert and Edit a data table. Inserts are fine, but when calling a page to edit the page should appear with the data already available in the textbox to edit. Everything is fine up to this point, but when editing data the original value seems as though data do not change. For example...page load with original value in textbox "Item 3" and i wanted to edit the textbox to "Item 4" even though "Item 4" appears within the textbox on screen in code behind "Item 3" is being passed. I searched the properties on the client and _initialValue = "Item 4" which is what i want and value = "Item 4" still good, but defaultValue = "Item 3" and it appears as though this is what is being passed in code behind. I tried to explain this as best as possible, I know it maybe confusing but any help would be appreciated.

Thanks,
Ron.
Tsvetina
Telerik team
 answered on 14 Sep 2011
7 answers
147 views
Hi sir,
          We are using  button type radrotator sir....

Our need is images are showing in rad rotator by two rows sir...Normally It shows image single row only...

I have attach my screenshot file sir....

Please kindly check it and say how to use rotator in two rows nu sir....
 
I am waiting for your valuable answer sir.

Regards
Balaji.J
Niko
Telerik team
 answered on 14 Sep 2011
4 answers
77 views
Hello,

I've a RadGrid (RadGrid1 in example) that's Enclosed by a RadAjaxPanel and ASP Panel:
<telerik:RadAjaxPanel runat="server" ID="rapEntryPurchase" ClientEvents-OnRequestStart="onRequestStart" LoadingPanelID="RadAjaxLoadingPanel1" >
  //RadComboBox
  <telerik:RadAjaxPanel runat="server" ID="rapPurchase" ClientEvents-OnRequestStart="onRequestStart" LoadingPanelID="RadAjaxLoadingPanel1">
    <asp:Panel ID="pnlPurchase" runat="server" Width="100%" ScrollBars="Horizontal" BackColor="Blue">
      //RadGrid1
    </asp:Panel>
    <telerik:RadAjaxPanel runat="server" ID="rapPurchaseLines" ClientEvents-OnRequestStart="onRequestStart" LoadingPanelID="RadAjaxLoadingPanel1">
      <asp:Panel ID="pnlPurchaseLine" runat="server" Width="100%" ScrollBars="auto">
        //RadGrid2
      </asp:Panel>
    </telerik:RadAjaxPanel>
  </telerik:RadAjaxPanel>
<telerik:RadAjaxPanel>

When moving the mouse over the HeaderText of the RadGrid1, some space is added at the end of the ASP Panel. This happens only when the horizontal scrollbar is activate/showed.

Does anyone have a solution for this problem?

Regards, 
  Jos Meerkerk
Pavlina
Telerik team
 answered on 14 Sep 2011
7 answers
162 views
Hi,

I am using two series on a single radchart:
Series 1: Bar
Series 2: Line (for reference)

Code:
/// <summary>
    /// This function creates the refernce line series of RadChart
    /// </summary>
    /// <param name="averageDailyMtdGoal">Average of Daily Goals of the date</param>
    private void CreateReferenceLine(double y)
    {
        // Setting properties of refernce line series
        ChartSeries referenceSeries = radChart.Series[1];
        referenceSeries.Appearance.LineSeriesAppearance.PenStyle = System.Drawing.Drawing2D.DashStyle.Dash;
        referenceSeries.Appearance.LineSeriesAppearance.Width = 1;
        referenceSeries.Items.Add(new ChartSeriesItem(0, y));
        referenceSeries.Items.Add(new ChartSeriesItem(radChart.Series[0].Items.Count + 0.5, y));
        referenceSeries.DefaultLabelValue = averageDailyMtdGoal.ToString() + "%";
        referenceSeries.Appearance.LabelAppearance.Visible = true;
        referenceSeries.Appearance.FillStyle.MainColor = Color.Red;
    }

PFA snapshots of two cases:
Case 1: Snapshot ReferenceLine_Visible.png: when there are more than one bars, the reference line is visible, which is an expected functionality.
Case 2: Snapshot Reference line_Not visible.png: shows the case when there is only one bar on the x-axis. It does not show the reference line.

I want to show the reference line in both the cases. Please help.

Thanks & Regards,
Priyanka Sethi

Evgenia
Telerik team
 answered on 14 Sep 2011
5 answers
126 views
Hi,

I have a page set up with a RadGrid that is sometimes set to the correct width when the page loads, but it is sometimes a little skinnier than it should be. Any post back and sometimes even a full page refresh makes the grid come back with the skinnier width.

Our site's width is 960px, and if I remove that, the grid doesn't have the issue (it looks like if the grid's parent element is explicitly set, the grid figures out how wide it should be--in this case, it seems to be figuring it out incorrectly sometimes?).

Notes:
    *the grid should be set to, and sometimes is set to, 1076px, but it is mostly re-sized to 1047px (a loss of 29px -- perhaps the width of the td's with class rgExpandCol, that trigger the detail table to bind?)

    *the container div with class="RadGrid" is the element whose width is being set

Any help would be much appreciated.

Thanks,

John
John
Top achievements
Rank 1
 answered on 14 Sep 2011
1 answer
64 views
I'm trying to implement custom dialog to show a user-friendly window to insert form's elements in radEditor, but I'm unable to find a workaround for a known issue on "getSelectedElement()" method of the radEditor client API.
My telerik controls version is 2011.2.830.35
To recreate the issue use this code:

<telerik:RadEditor ID="RadEditor1" runat="server" >
    <ContextMenus>
        <telerik:EditorContextMenu TagName="INPUT">
            <telerik:EditorTool name="fieldModifica" Text="Modifica proprietà..." />
        </telerik:EditorContextMenu>
        <telerik:EditorContextMenu TagName="SELECT">
            <telerik:EditorTool name="selectModifica" Text="Modifica proprietà..." />
        </telerik:EditorContextMenu>    
    </ContextMenus>
    <Content>
        <select id="aSelect"><option value="first">first</option><option value="second">second</option></select><br />
        <input type="text" id="anInputBox" value="an input box"></input>
    </Content>
</telerik:RadEditor>
 
 
<script type="text/javascript">
//<![CDATA[
 
function ModifyFieldProperty(commandName, editor, args, tagname, fieldtype) {
    var elem = editor.getSelectedElement(); //returns the selected element.
    alert("elem.tagName: " + elem.tagName + " - tagname: " + tagname);
}
 
Telerik.Web.UI.Editor.CommandList["fieldModifica"] = function(commandName, editor, args) {
    ModifyFieldProperty(commandName, editor, args, "INPUT", "text");
};
 
Telerik.Web.UI.Editor.CommandList["selectModifica"] = function(commandName, editor, args) {
    ModifyFieldProperty(commandName, editor, args, "SELECT", "");
};
 
//]]>
</script>

If you try to right-click on the select or text box and choose the voice "Modifica proprietà..." in the context menu the code show you the correct value for "elem.tagName" in IE and Firefox, but it's ever "BODY" for Goggle Chrome (first issue).

Second issue: in firefox the select element is not clickable and so, it's impossible to show the custom context menu.

Third issue: in Google Chrome the select element is clickable but not show the context menu.

The browser version were I'm testing the code:

Chrome 13.0.782.220
Firefox 6.0.2
IE 9.0.8112.16421

There's a workaround for this issues?
Many thanks
Luigi Gaeta

Rumen
Telerik team
 answered on 14 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?