some attributes don't work

Feb 2, 2011 at 8:46 AM

Hi,

when creation in inputHtmlAttributes some attributes like class or style, in the html they are created but when rendering not applied.

So if there anything to do?

Feb 2, 2011 at 8:14 PM

Are you using the latest change set?

Feb 2, 2011 at 9:05 PM

Yes I do, and I tested with the demo given.

Feb 2, 2011 at 9:15 PM

I just made sure that this code:

 

            var name = new TextBox
            {
                ResponseTitle = "Name",
                Prompt = "Enter your full name:",
                DisplayOrder = 20,
                Required = true,
                RequiredMessage = "Your full name is required"
                 
            };

            name.InputHtmlAttributes["class"] = "thisShouldWork";

 

 

Gave me:

<input type="text" class="thisShouldWork"/>

And it does work.

 

If you are getting what you expect in your HTML, then you will need to use CSS to help you get what you're after.

Maybe if you give me some specifics I can help.

 

 

Feb 2, 2011 at 9:57 PM
Edited Feb 2, 2011 at 9:58 PM

So I want to include jquery datepicker

I get the right html from the engine

<input type="text" class="datepicker"/>

in the javascript I define this function


$(document).ready(function () {
    $("#datepicker").datepicker();
});

when declaring the input directly in the html file it work fine but when generating the form dynamically no.

I hope I'm not missing anything!

Feb 2, 2011 at 10:05 PM

Your selector is wrong. Use a . instead of # to select a class:

 

$(document).ready(function () {
    $(".datepicker").datepicker();
});

 

 

Feb 3, 2011 at 8:35 AM

Thank you for the response, also the problem was with the cache of Internet explorer.