Showing posts with label properties. Show all posts
Showing posts with label properties. Show all posts

Wednesday, March 28, 2012

Why Properties Sub Controls?

I don't understand why ACT always uses a special sub control within its controls.

Usually in ASP.NET controls are designed to have attributes on their own. Why this design?

TIA,

Axel Dahmen

Hi Axel,

The Toolkit sits directly on top of the ASP.NET AJAX Framework, which chose to use this approach. I think it's because this is how control extenders work in WinForms and they were going for a familiar approach - but this has actually been changed in the beta so that the properties, etc., have been moved up to the extenders.

Thanks,
Ted

Monday, March 26, 2012

window.debug has no properties since upgrade from RC to RTM

Hi!

Since I upgraded from AJAX RC to AJAX RTM I get following erros:

'window.debug.isDebug' is null or not an object -> IE7
window.debug has no properties -> Firefox
if (!window.debug.isDebug) { ...ScriptResource.axd (line 107)

What can be wrong?

Thanks for your help

Martin

The problem is fixed now. It seems that the control toolkit was not up to date within the project although I used "Rebuild Solution" and followed the release notes.

Saturday, March 24, 2012

Wrapper control for Slider Extender and Properties

I've written a control and that inherits from Panel and ITextControl. In CreateChildControls I create a table containing a text box and label, then I create the slider extender and properties pointing to the appropriate controls. The control loads properly (visually), but when I click the slider I get a series of javascript errors (Invalid Argument). If anyone has any suggestions they would be helpful.

Hi,

could you post the code that instantiates the slider extender?


/// <summary>
/// This web control class renders a Centralpoint console textbox.
/// </summary>
[ValidationProperty("Text")]
public class ConsoleSlider : Panel, ITextControl
{
private TextBox tbxSlider = null;
private Label lblTarget = null;
private SliderExtender seExtender = null;
private SliderProperties seProperties = null;

public ConsoleSlider() : base()
{
}

/// <summary>
/// This method is overridden to create the child controls of the console editor.
/// </summary>
protected override void CreateChildControls()
{
base.CreateChildControls();

HtmlTable table = new HtmlTable();
this.Controls.Add(table);

HtmlTableRow row = new HtmlTableRow();
table.Rows.Add(row);

HtmlTableCell left = new HtmlTableCell();
row.Cells.Add(left);

HtmlTableCell right = new HtmlTableCell();
row.Cells.Add(right);

tbxSlider = new TextBox();
tbxSlider.ID = this.ID + "_Slider";
left.Controls.Add(tbxSlider);

lblTarget = new Label();
lblTarget.ID = this.ID + "_Target";
right.Controls.Add(lblTarget);

seExtender = new SliderExtender();
seExtender.ID = this.ID + "_Extender";

seProperties = new SliderProperties();
seProperties.ID = this.ID + "_Properties";
seProperties.Minimum = 0;
seProperties.Maximum = 100;
seProperties.Steps = 1;
seProperties.Length = 300;
seProperties.EnableHandleAnimation = true;
seProperties.Orientation = SliderOrientation.Horizontal;

seProperties.TargetControlID = tbxSlider.ID;
seProperties.BoundControlID = lblTarget.ClientID;
seExtender.TargetProperties.Add(seProperties);

this.Controls.Add(seExtender);
}

/// <summary>
/// Gets or sets the control text.
/// </summary>
public string Text
{
get { this.EnsureChildControls(); return lblTarget.Text; }
set { this.EnsureChildControls(); lblTarget.Text = value; }
}
}


Hi,

mkerchenski:

seProperties.Steps = 1;

the problem is in the above statement, since it has no sense to set 1 step (it means 1 possible value, so there would be no need for a slider).

However, this is a "pathological" case that causes a bug since the slider extender is not able to handle this situation at the moment. I'll make sure to fix this for the next release.

Since the number of steps is the number of possible values, try to set steps > 1 and let me know if it solves the problem.

You can found a related threadhere.


I've tried a few different values for the Steps property and it doesn't seem to make any difference at all. If you disable script debugging (in IE) the control doesn't slide, and if you enable script debugging you get the error described initially. In the firefox javascript console I get the following errors:
Error: Found unclosed string '"'. Selector expected. Ruleset ignored due to bad selector.
Error: Unexpected end of file while searching for closing } of invalid rule set.
I'm not entirely sure they're related, but they're not there when the slider is not present.

Wednesday, March 21, 2012

Wrong EventName triggers. How come?

Hi

In the project I have two GridViews: master GridView1 and slave GridView2. The latter resides on the UpdatePanel with properties as follows:

AsynchPostBack ControlID=GridView1

EventName=SelectedIndexChanging

It works fine: if I select a row from GridView1, partial postback takes place and GridView2 re-populated

But! If I set GridView1.AllowSorting=true and click on any of GridView1 titles, it goes again with the partial postback! I don't have my GridView1.Sorting event handler in the list of UpdatePanel.ControlID but it acts as well it is.

How can I prevent a partial postpack in the case above? I need my page be sent as full old-way post back, when click on the GridView1 headers.

Hi Mabanza,

Mabanza:

But! If I set GridView1.AllowSorting=true and click on any of GridView1 titles, it goes again with the partial postback! I don't have my GridView1.Sorting event handler in the list of UpdatePanel.ControlID but it acts as well it is.

this sounds like you've let UpdatePanels UpdateMode on the default valueAllways. Please set it toConditional.


This relates to the children updates. Anyway, I did, no effect.

This boiled down to the follows, actually. I can not register the title (which is LinkButton on the server) as

RegisterPostBackControl(LinkButton);

It works the same wrong way - as partial post back.

How to register LinkButton for full postback?

Thanks.


May try use another way to go. Instead declaring the SelectedIndexChanging event as trigger, use in the SelectedIndexChanched event updatepanelsUpdate() method. eg.

void GridView1_SelectedIndexChanged(Object sender, EventArgs e){// Your logic here UpdatePanel1.Update();}

So you be sure, updatepanel only updates on changing the selected index from your gridview.


Good idea. But it does not suit me. I have

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest) andadd_beginRequest(StartRequest) hooked.

If I update panel on the server side, I won't be able to use that, right?

Thanks.


Mabanza:

If I update panel on the server side, I won't be able to use that, right?

not sure about that. To put it bluntly, i'm not a fan from javascriptCool Anyway.

Mabanza:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequest) andadd_beginRequest(StartRequest) hooked.

I dont now where in the page lifecycle these events are fired, but for updating the gridview after page index changing, a roundtrip to the server is required. From my point, let the javascript beginRequest and endRequest events still active, give the UpdatePanel.Update method a try and look whats up on your page.