Showing posts with label select. Show all posts
Showing posts with label select. Show all posts

Wednesday, March 28, 2012

Change CollapsiblePanelExtender properties programatically within a DataList

I'm currently using CollapsiblePanelExtender within a DataList. The DataList contains a Label where the user will select to expand/contract theCollapsiblePanelExtender. TheCollapsedproperty withinCollapsiblePanelPropertiesis set tofalse. I would like to expandonly the first panel in the DataList when the page loads while the remaining panels remain collapsed.

I am intending to set theCollapsiblePanelPropertiesto true for the first item in the DataList within the DataList1_ItemDataBound event. How do I reference theCollapsiblePanelProperties as it does not contain an ID likeCollapsiblePanelExtender as I can not perform the following?

CollapsiblePanelProperties cpp =newCollapsiblePanelProperties();

cpp = (CollapsiblePanelProperties)e.Item.FindControl("CollapsiblePanelProperties");

Is there a different approach? Thanks in advance.

This has come up a couple of times in the past few days. A good solution when it works is something like "Extender1.GetTargetProperties(Control1)". I think that will work here, so please give it a try!

Thanks David. Extender1.GetTargetProperties(Control1) works!

Control1 being the TargetControlID of the CollapsiblePanelProperties. In my sample, Control1 is Panel1. Here is the code within the DataList1_ItemDataBound event for everyone...

if

(e.Item.ItemType ==ListItemType.Item){ CollapsiblePanelExtender ce =newCollapsiblePanelExtender();

ce = (

CollapsiblePanelExtender)e.Item.FindControl("CollapsiblePanelExtender1"); Panel pan =newPanel();

pan = (

Panel)e.Item.FindControl("Panel1"); if (e.Item.ItemIndex == 0){ CollapsiblePanelProperties cpp;

cpp = ce.GetTargetProperties(pan);

cpp.Collapsed =

false;

}

}

Monday, March 26, 2012

cascadingdropdowns when only one listitem

I am happily using cascading dropdowns for a three-level stack. In some cases, there is only one item in the generated list apart from the select prompt. Common sense and good design suggests that the one item should be auto-selected but this has not been implemented in the Toolkit.

I tried to implement it by setting the selected attribute (third parameter) to 'true' in the Web service. This worked for the displayed ddl, but the underlying value was not set . Hence the next level in the dropdown failed because no value was supplied.

Is this a bug or am I doing something wrong?

The relevant line in the VB Web Service (PageMethod) is:

values.Add(

New CascadingDropDownNameValue(sCompany, sCompanyId,True))

If I do not use the third parameter, I get the standard result with my Prompt showing in the ddl, and everything working when I actually select the one item.

This sounds like a bug. Could you whip up a quick sample page demonstrating the problem and file the issue at CodePlex?

http://www.codeplex.com/WorkItem/List.aspx?ProjectName=AtlasControlToolkit

Thanks!

Saturday, March 24, 2012

CascadingDropDown with a Database fails when Table has more than 908 rows

Using CascadingDropDown with a Database fails when Table has more than 908 rows

with "SELECT * FROM TABLA1" CascadingDropDown fails with message [Method error 500] otherwise with "SELECT TOP 908 * FROM TABLA1" works fine.

can somebody help me? my Table has more than 908 rows, I need to load about 1100 rows

Thanks

It's due to this:http://ajax.asp.net/docs/mref/P_System_Web_Script_Serialization_JavaScriptSerializer_MaxJsonLength.aspx

The JSON serializer has a default max length (see the bottom of the entry). Increase that number in web.config.


thank you for your quick and accurate responseBig Smile now it works

have been a pleasure


hi,

i have tried to uncomment the <jsonserialization> attribute in the web.config file. i get an error at method error[12030]. i need to retrive about 2000 rows in my dropdown list. any help would be greatly appreciated.


ooops..its working now.i had previously included teh convert tag below the json tag in the web.config file. when i removed the converter tag, its working well...

Wednesday, March 21, 2012

CascadingDropDown question

I have weird problem with CascadingDropDown. I have user control with two dropDowns. If I get into this page through Select Class -> Select Category pages I set

CascadingDropDown1.Enabled =false (and so on for all of them)
and use query string to populate DDLs and set selected value. Or I can directly get into this page and use CascadingDropDown since I don't have query string.

But it doesn't work this way. When I get into this page through Select Class -> Select Category pages everything is fine, but after first postback ddl's datasources are empty.

If I completely remove CascadingDropDown definition from code - it works OK.

Any idea why this happens? Not sure, probably I'm missing something or it's CascadingDropDown bug.

Thanks.

Vladimir.

Hi Vladimir,

Can you elaborate what do you mean by "Select Class -> Select Category pages" ?

I don't quite understand your problem.


Thanks very much for the replay.

I mean that I have on the page two DropDownLists. First I select Class then by this Class i can select Category. After I select Category I'm able to populate GridView.

On this page I can get either through direct link (in this case I don't have data for Class and Category and wanted to use CascadingDropDown) or I can go first on the page SelectClass. Then on the page SelectCategory which will move to the page where I'll have Class and Category already selected and available in the query string in the url address.

This is basically what I wanted.

CascadingDropDown options is null or not an object

I have a couple of dropdown CascadingDropDown and the user is required to select an option from the first and then the second, and then click add. However, if they press add to fast, I get the error "'options' is null or not an object"

It's as if the the second dropdown is not full before the event is posted?!?!? Anyone know how I can prevent this?

Hi Poidda,

Based on my experience, to resolve this kind of issue we should make sure whether the problem is occurred on the client side or on the server side. Based on your description, I think your problem is likely occurred on the server side.

If it is a client issue, we suggest that you should keep the Button to be disabled until the last essential CascadingDropDown is selected. For example:

function pageLoad(){
$find("myCDEState").add_selectionChanged(onCCDSelected)
}
function onCCDSelected(){
//your other javascript code here.

$get("<%=Button.ClientID%>").disabled = false;
}

Otherwise , you should do some checking work on the server side. If it's null, return to the orignal page.

Best regards,

Jonathan