Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

AppTheory specializes in solutions based on the DotNetNuke platform and has 2 employees on the DotNetNuke Core Team.
  Ads  
OnyakTech
 


  Sponsors  

Meet Our Sponsors

ExactTarget email software solutions
Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
Salaro -- Skins and more
OnyakTech
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Localize It! (L...  localizing ListItem, CheckBoxList, ETC
Previous Previous
 
Next Next
New Post 1/17/2008 1:21 PM
User is offline Josh Squires
9 posts
Structured-Systems.net
10th Ranked


Re: localizing ListItem, CheckBoxList, ETC 

After changing my ListBox to a DropDownList I noticed another issue and it could just be me so forgive me if I'm just doing it wrong but here goes.

Ok so I have a CustomControl this control is made up of several Panels of which some are hidden and others are not based on the users progress through the questionnaire.

Markup Snippet:

 <asp:Label ID="Sec1Q8Label" resourcekey="Sec1Q8Label" runat="server" />
 <asp:DropDownList ID="Sec1Q8"  OnSelectedIndexChanged="Sec1Q8SelectChanged" runat="server" Rows="1" CausesValidation="false" AutoPostBack="true">
  <asp:ListItem resourcekey="Sec1Q8Option0" />
  <asp:ListItem resourcekey="Sec1Q8Option1" />
  <asp:ListItem resourcekey="Sec1Q8Option2" />
  <asp:ListItem resourcekey="Sec1Q8Option3" />
  <asp:ListItem resourcekey="Sec1Q8Option4" />
  <asp:ListItem resourcekey="Sec1Q8Option5" />
  <asp:ListItem resourcekey="Sec1Q8Option6" />
  <asp:ListItem resourcekey="Sec1Q8Option7" /> 
 </asp:DropDownList>

 <asp:Label ID="Sec1Q8OtherLabel" resourcekey="Sec1Q8OtherLabel" runat="server" Visible="false" />
 <asp:TextBox ID="Sec1Q8Other" resourcekey="Sec1Q8Other" runat="server" Visible="false" />

 

Code Snippet:

        protected void Sec1Q8SelectChanged(object sender, EventArgs e)
        {
            if (((DropDownList)sender).SelectedIndex == 7)
            {
                Sec1Q8OtherLabel.Visible = true;
                Sec1Q8Other.Visible = true;

            }
            else
            {
                Sec1Q8OtherLabel.Visible = false;
                Sec1Q8Other.Visible = false;
            }
        }

 

Now the problem is this in the PostBack the DropDownList appears to be rebuild from scratch nulling out the selection. The same is true for RadioButtonList, I haven't tested any other than standard TextBox which is NOT regenerated and DOES retain its inputted value. I know this control works in a normal web form environment but prehaps I have got in over my head as far as understanding how DNN is implementing the web form.

Any information would be great.

Thanks again,

Josh

PS.

I did report the enhancement you wanted me to do Sebastian

 
New Post 1/17/2008 8:06 PM
User is offline William Severance
821 posts
www.wesnetdesigns.com
7th Ranked






Re: localizing ListItem, CheckBoxList, ETC 
Modified By William Severance  on 1/17/2008 11:07:19 PM)

Odd - I don't see thing obvious in your markup or code that would cause loss of the selected item on a post back. Although I've never coded a DDL with Rows=1 and don't think that is the problem, you might try it without the Rows attribute or with Rows=# higher than 1. You havn't disabled v13wstat3 for the DDL or the entire .ascx control have you?  Are there other modules/controls on the page that may be triggering their own postback? Are you using an Ajax Update panel or have you enabled "supports partial rendering" in the module definitions? Are you doing a Response.Redirect back to this control from another control such as a detail view? This would not be considered a postback and would reset the DDL's selected index.

As this is unrelated to the original post, you may wish to start a new thread in the Extend It !(Asp.Net 2.0) forum.


Bill, WESNet Designs
 
New Post 1/18/2008 5:31 AM
User is offline digmike
188 posts
www.dignuke.com
9th Ranked




Re: localizing ListItem, CheckBoxList, ETC 

Hi Josh,

Is SelectedIndex Null, -1, or 0?  Try assigning some unique values to your ListItem's

Thanks,
Mike


dignuke.com DotNetNuke Modules
 
New Post 1/18/2008 7:22 AM
User is offline Josh Squires
9 posts
Structured-Systems.net
10th Ranked


Re: localizing ListItem, CheckBoxList, ETC 

Its not actually null it is 0 regardless of your selection and there is not value even though the value was listed when you made the selection. I can almost guarantee that it has to do with localization. I think that when the postback is requested the localization is started again clearing out localizaed values however the post is then completed before the localization is completed. Thus I get a SelectedIndex of 0 and a blank value.

This is crazy, I have to be doing something wrong because I can't imagine that I am the only one that has put a custom control questionnaire in a module before.

 
New Post 1/18/2008 8:57 AM
User is offline William Severance
821 posts
www.wesnetdesigns.com
7th Ranked






Re: localizing ListItem, CheckBoxList, ETC 

Mike is on the right track - without each ListItem having a unique value, the ASP.Net's determination of the selected item will always return the first matching, that is, the first item in the list.  In the control localization method in DotNetNuke.Framework.PageBase the following sets each ListItems Text property but does nothing to set the Value property:

If Not key Is Nothing Then
      Dim value As String = Services.Localization.Localization.GetString(key, ResourceFileRoot)
      If value <> "" Then
           ctrl.Items(i).Text = value
      End If
End If

Although you might want to add another bug report to Gemini for this, I'm not sure I would want to add any extra processing steps list control localization as most developers will provide a unique value to each list item as part of the markup. Try assigning a unique value (i.e. 0, 1, 2, 3 . . .) to each ListItem and let us know what happens.


Bill, WESNet Designs
 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Localize It! (L...  localizing ListItem, CheckBoxList, ETC
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Where Every Home is an Investment
Where Every Home is an Investment
www.nestbrokers.com
Faculty of Graduate and Postdoctoral Studies
At the graduate level, the University of Ottawa offers more than 180 graduate certificates, master's degrees and PhDs, as well as interdisciplinary programs such as Women's Studies and Canadian Studies. Many postdoctoral opportunities are available in both the sciences and the humanities. For further information, please consult the site of the Faculty of Graduate and Postdoctoral Studies.
www.grad.uottawa.ca
Vekkin Solutions
Vekkin Solutions provides complete website solutions and custom module development to churches and small businesses.
www.vekkin.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP