Ask a questionAsk a question
 

QuestionProblems creating Web Custom Controls

  • Friday, November 06, 2009 1:57 PMCharly OM Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Houston...I've got a problem!! I'm developing some web custom controls with jQuery embebed to give a little fashion touch to web applications in .Net. But I wanna do it well, so that's the problem!

    Problem:
    I'm developing a TabControl which can be showed like a tabs or an accordion. It consist in a web control called "ControlTab" which extend WebControl, and another web custom control called "Tab" which extend Panel. I checked if I don't override RenderContent Function in both classes I can put another web controls with events and everything work ok, but I need to override RenderContent in "ControlTab" class. Then I try to put a DropDownList with Autopostback=true inside a Tab which at the same time is inside a ControlTab but Render doesn't write javascript function on selectIndexChange event on html tag...
    Maybe it woulb be better if I let you the code of the critical part of RenderContent Method. I don't understand cause I call to the original RenderContent of Child Controls:

    string

     

    html = "<div id='" + IdTabControlClient + "' style='" + ControlTabStyle() + "'> <ul>";
    for (int i = 0; i < Tabs.Count; i++){
         html +=
    "<li><a href='#" + IdTabControlClient + "-tab-" + i.ToString() + "' onclick=\"$('#" + idSelectedIndexHidden + "').val(" + i.ToString() + ");\" title='" + Tabs[i].Titulo + "'>" + Tabs[i].Titulo + "</a></li>";
    }
    html +=
    "</ul>";
    output.Write(html);
    for (int i = 0; i < Tabs.Count; i++){
         output.Write(
    "<div id='" + IdTabControlClient + "-tab-" + i.ToString() + "' style='" + TabStyle(Tabs[i]) + "'>");
         for (int j = 0; j < Tabs[i].Controls.Count; j++)
          {
           Tabs[i].Controls[j].RenderControl(output); //<-- DropDownList would render here!
           }
           output.Write(
    "</div>");
    }
    output.Write(
    "</div>");

    • Moved byDavid M MortonMVPFriday, November 06, 2009 1:59 PMASP.NET Questions are off-topic at C# General. (From:Visual C# General)
    • Edited byCharly OM Friday, November 06, 2009 2:00 PM
    •  

All Replies