Showing posts with label code. Show all posts
Showing posts with label code. Show all posts

Wednesday, March 28, 2012

System.Web.UI.Timer interval in client side code

Has anyone successfully set the Interval property in a System.Web.UI.Timer control using client side scripting of any language?

var timer = $find('<%= Timer1.ClientID %>');
timer.set_interval(5000);

FYI, some other methods are:

timer.get_interval();
timer._startTimer();
timer._stopTimer();
timer.set_enabled(true/false);


If this works I owe you a pretend steak dinner. Spent all day yesterday trying to track this down.


Big Smile Let me know if it does. I like my pretend steaks done pretend medium.


Okay so at first it didn't work. So I started experimenting.

It works when there's no master page, and just one single page, and the script is inside the page, call this TestSingle.aspx.

So I moved it to the child page, the timer resides on the child page, and put the script inside the child page and it works, call this Child.aspx.

So then I moved the script to the outside file that is loaded by the master page into every page and the function fails to find Timer1.

So then I used TestSingle.aspx again, and this time loaded the function from an outside .js file, and it failed to find Timer1.

Long story short, it works, but if it's trying to access Timer1 via script in an outside file, it fails to find Timer1. Is there some qualifier I need now?


Can you post the contents of your .js file as well as the source code where you reference it in the master page?


The only thing I put in the .js file was:

function StopTimer()
{
alert(1);
var timer = $find('<%= Timer1.ClientID %>');
alert(timer);
//timer.set_interval(5000);
alert(timer.get_interval());
//timer._stopTimer();

}

<%@. Page Language="C#" AutoEventWireup="true" CodeBehind="TestSingle.aspx.cs" Inherits="Website.TestSingle" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title><script src="./script/Test.js" type="text/javascript"></script> </head><body> <form id="form1" runat="server"> <div>   <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> </div> <asp:Timer ID="Timer1" runat="server"> </asp:Timer> <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="StopTimer()" /> </form></body></html>

That setup fails to find Timer1, not even using a master child setup.


Take out the <script src="./script/Test.js" type="text/javascript"></script> and reference it via your script manager control.

<asp:ScriptManagerID="ScriptManager1"runat="server">
<Scripts>
<asp:ScriptReferencePath="./script/Test.js"/>
</Scripts>
</asp:ScriptManager>


Nope didnt work.


Sorry I didn't catch it the first time around...

In the .js file you can't use the <%= %> notation. That is strictly an ASP.NET thing. The only thing that can be in the .js file is pure javascript. So you want it to look like:

var timer = $find('Timer1');

$find() does take a second, optional parameter that allows you to specify the parent of the component you're looking for. That basically serves the same purpose as requiring it to use the ClientID of the control. You can read more about that here: http://www.asp.net/AJAX/Documentation/Live/ClientReference/Sys/ApplicationClass/SysApplicationFindComponentMethod.aspx


You can't use inline server script in your JavaScript include files. So, $find('<%= Timer1.ClientID %>') is literally looking for a control with the client ID of<%= Timer1.ClientID %>.

I'd set a JavaScript variable in pageLoad() with the Timer's ClientID and then reference that in the included script.


So how does one access the Client ID from javascript? <% ClientID %> ?


OnClientClick="StopTimer(<%= Timer1.ClientID %>)"

function StopTimer(args) {
var timer = $find(args);
timer.set_interval(5000);
}


Well yeah that achieves stopping it with a button. But in actuality what I'm going to do is "onfocus" on a TextBox/ComboBox/Etc. call StopTimer, and on a onblur turn it back on. This naturally has to happen within a millisecond, and be extremely easy to code into the project. ie StopTimer and StartTimer exists in a separate file and I just past "onfocus=StopTimer() onblue=StartTimer()" into the <input>'s, or in the pageload set attributes for windows controls.

So yeah, I could put that function you wrote in the outside .js file and just have the function take a parameter. But that's gonna make the HTML even bigger then it is already, although that should work.

And every child has TimerTicker added to it programmatically from the inherited root class every child page inherited. That way I dont have to manually add it to every child page someone makes, this solution is already at 30 child pages based off same master.


Yeah it's not finding hte control even with the args method you posted. It's acutally erroring out and giving syntax error. Adding ' ' to either side on StopTimer('<%= Timer1.ClientID %>') just sends the string to the method.

Tab container bug

Hi,

while changing the backcolor of tabcontainer, this one (the tabcontainer) has blast all the page code away:

Line 16: "TabPanel1" runat="server">Line 17: "server">Companii"281479271677955" href="" onclick="return;">Line 18: "server">Line 19: "server" ID="UpdatePanel1" __designer:dtid="281479271677957">"281479271677958">

I checked twice this error and happens only after adding tab panels.

Is a tab container or is something wrong with my application? Or is because of the update panel situated inside of a tab panel ?

Getting the same issue when changing the properties of the tabcontainer in a design mode...


Same problem here!!!!

Everytime I set the width of the TabContainer in design view, every<ContentTemplate>gets replaced with <system.web.ui.control>IndifferentIndifferentIndifferentIndifferentIndifferent

Tab Container doubts

Hi,

I have two questions regarding the Tab Container Control:

1) How can I get the current Tab in the code behind ?

2) if I have five tabpanels, with one grid view on each one and I want to use the updatepanel.

should I create one updatepanel and place all the tabpanels on it, or create one updatepanel for each tabpanel ?

Thanks !

I haven't tried your Tab / Update Panel combinations, but getting the current TabIndex in your server code is easy.

Dim TabNoAsInteger

TabNo = TabContainer1.ActiveTabIndex

Remember Active.TabIndex is Zero based so if you have 4 tabes and the last one is selected, the active index will be "3"


Hi,

Personally, I'd place different UpdatePanel for each tab. Haven't done this ever too, you may have a try and know if it works.


The Tab / Update panel combination worked smothly by using a diferent updatepanel for each tabpanel, like Raymond suggested.

If you want, you can use an update progress like this:

<asp:UpdateProgressID="UpdateProgress1"runat="server"AssociatedUpdatePanelID="Tabs$Panel1$upd1">

Thanks Joe and Raymond,

Skynyrd

Monday, March 26, 2012

Tab Control - create tab on gridview selectindexchanged - code posted

I am using ajax tab control. I want to create a new tab everytime i click on the select of the gridview. Problem is it only allows me to create 1 tab. When I click on another select in the gridview - it doesn't allow to create another tab and gives me an error.

Is there another way to do this?

protectedvoid gv1_SelectedIndexChanged(object sender,EventArgs e)

{

UserControl ucR = (UserControl)LoadControl("../test.ascx");

ucR.ID = ((GridView)sender).SelectedDataKey.Value.ToString();

TabPanel tab =newTabPanel();

tab.Controls.Add(ucR);

tab.HeaderText = ((GridView)sender).SelectedDataKey.Value.ToString();

tcResults.Tabs.Add(tab);

}

After postback it loses the tabs - had to load in session and re-make the tabs in page_init


What error you are getting ?

Tab control disabling tab from code-behind

Hi i think i found a bug.

When i disable a tab from the code behind using following code the text of the tab stays on the screen.

Permits_tab.Enabled =

False

Permits_tab.Visible =

False

So instead i wrote the following code

ScriptManager.RegisterStartupScript(Main_Tabs,

Me.GetType,"removePermitTab","setTimeout(""$find('Main_Tabs').get_tabs()[1].set_enabled(true);"",100);",True)

it basically disables it after the object is build but there's a catch. I had to use timeout to do this because main tab is not built at the place of the code is placed. So if the page loads slow the timeout will run early if the page loads fast enough then the client will see the tab disappear from the tab and get confused.

It's working for me... Sort of.. I just set visible=false without setting enabled. The thing is, the nice gradient tab disappears just for that tab, but the headertext remains...
thats not working actually if you disable from client side using jscript no headertext no nothing shows up :P :)

Actually there is one much simpler solution ;)

Permits_tab.visible = false;

Permits_tab.headertext=""

And this works perfectly for me.


That solution is so sexy it brought tears to my eyes. Yes
HEYYYY thats cheating, hehehehe but works like a charmStick out tongueBig SmileBig Smile

Saturday, March 24, 2012

Tab Panel - Problem in trapping Server Side Change Event

Hi,

This is related to the problem facing in trapping the Server Side Change Event of 'Tab Container - Tab Panel'

Below is the code:

<cc1:TabContainer ID="TabContainer1" runat="server" OnClientActiveTabChanged="Change"OnActiveTabChanged="TabContainer1_ActiveTabChanged">
<cc1:TabPanel ID="TabPanel1" runat="server">
<HeaderTemplate>Tab 1</HeaderTemplate>
<ContentTemplate>Tab 1 Content</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel2" runat="server">
<HeaderTemplate>Tab 2</HeaderTemplate>
<ContentTemplate>Tab 2 Content</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>

There are two events provided to handle Client & Server Side events seperately. Client Event works properly.

For reference : http://ajax.asp.net/ajaxtoolkit/Tabs/Tabs.aspx

Problem:The server side event is not working.

Quick help will be highly appreciated.

Regards,

Arun Manglick


Hi,

Here is the solution.

Add 'AutoPostback' property.

<cc1:TabContainer ID="TabContainer1" runat="server" OnClientActiveTabChanged="ActiveTabChanged" OnActiveTabChanged="TabContainer1_ActiveTabChanged"AutoPostBack="True">

Reference : http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=7739

The solution seems to be strange. This solution is been added on 02Jun07. Before that it was a major challenge to overcome that.

Regards,

Arun...

Tab Panel problem

I'm trying to programatically change tabs from within javascript without having to go back to the server. After perusing some of the source code I landed on the following simple solution below. The problem I have is that it works in IE but not Firefox and I'm at a loss as to why. I've posted my working (in IE) copy athttp://ajax.jayhawk.net but the source below is complete. (The reason I need to do this is one of my tabs displays a google map and it doesn't draw properly if the tab is not initially visible, so the page loads with the map visible, but during the onload() code it switches to thereal first tab. I saw that some else had this issue but got no responses.)

Also, while I have your attention, I've found it difficult to learn the .NET-munged name of a control on the client side. For example, I have here ID="TabContainer1" and in this trivial example it doesn't change. However, in a more complex application it might be given the name "ctl00_ContentPlaceHolder1_TabContainer1". My "solution" to the problem is to add a hidden <div> at the end that contains nothing but "<%=TabContainer1.ClientID%>" and then use a document.getElementById to fetch the actual name which I can use with $find(). There's got to be a better way to do this, doesn't there?

Thanks in advance for the feedback, and thanks for some great tools!
-bp

<%@dotnet.itags.org. Page Language="VB" AutoEventWireup="true" CodeFile="default.aspx.vb" Inherits="_Default" %>

<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Tabs Test Page</title>
<script type="text/javascript">
var tab = 0;
function changetab()
{
var strContainer = document.getElementById("divTabContainer1").innerText;
var container = $find(strContainer);

container.set_activeTabIndex( ++tab > 2 ? tab = 0 : tab );
}
</script>
</head>
<body>
<form id="form1" runat="server">
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</cc1:ToolkitScriptManager>
<cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" Height="142px"
Width="269px">
<cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="TabPanel1">
<ContentTemplate>
This is tab #1
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="TabPanel2">
<ContentTemplate>
Now you're looking at tab #2
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="TabPanel3">
<ContentTemplate>
And, finally, it's tab #3!
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer><br />
<input type="button" onclick="javascript:changetab();" value="Click Me!" />
</form>
<div id="divTabContainer1" style="visibility: hidden;"><%=TabContainer1.ClientID%></div>
</body>
</html>

Hi,
I guess the reason is that innerText isn't a valid property for div element when work in Firefox. If you use a input element here, it works fine.
For instance:

var tab = 0;
function changetab()
{
var strContainer = document.getElementById("ipt").value;
var container = $find(strContainer);

container.set_activeTabIndex( ++tab > 2 ? tab = 0 : tab );
}

<input type="hidden" id="ipt" value=<%=TabContainer1.ClientID%> /
As a matter of fact, you don't need to use a element to hold its id, please try this:

</form>
<script type="text/javascript">
var tab = 0;
function changetab()
{
var container = $find("<%=TabContainer1.ClientID%>");

container.set_activeTabIndex( ++tab > 2 ? tab = 0 : tab );
}
</script>
</body>
</html>

Hope this helps.

TabContainer and DynamicServicePath

I am using a TabContainer and I would like to display the content of an aspx file inside each TabPanel of the TabContainer. I tried this code :

<ajaxToolkit:TabContainerrunat="server"ID="Tabs"Height="600px"Width="600px">

<ajaxToolkit:TabPanelrunat="server"ID="Panel1"HeaderText="Product Groups"DynamicServicePath="~/ConfProductGroup.aspx"Visible="true">

<ContentTemplate>

</ContentTemplate>

</ajaxToolkit:TabPanel>

<ajaxToolkit:TabPanelrunat="server"ID="Panel3"HeaderText="Products"DynamicServicePath="~/ConfProduct.aspx"Visible="true"/>

</ajaxToolkit:TabContainer>

But the tabcontainer doesn't display the content of aspx pages (ConfProduct.aspx , ConfProductGroup.aspx) when I click on a TabPanel.

Hi Suzi,

If you want to contain an entire asp.net page inside a TabPanel, you will probably need to fetch it prgramatically.

This video will show you how to do it.

http://asp.net/learn/videos/view.aspx?tabid=63&id=120

Joe


Thank you Joe for your advice. I am trying to test with this solution.


I am trying a sample example as you advice me. I have a Master page and an aspx page named Ajaxtab.aspx. I have no error when I test the Ajaxtab.aspx without a Master Page File. But if I add a master page file. I have an unknown error . Below, you will find my code. Thank you.

ajaxtab.aspx :

<%@.PageLanguage="C#"AutoEventWireup="true"MasterPageFile="~/Site.master"CodeFile="Ajaxtab.aspx.cs"Inherits="Tests_Ajaxtab"Title="MediterrumWorks : Ajaxtab" %>

<%@.MasterType

virtualpath="~/Site.master" %>

<%@.Register

Assembly="AjaxControlToolkit"

Namespace="AjaxControlToolkit"

TagPrefix="ajaxToolkit" %>

<asp:Content

ID="MainContent"

ContentPlaceHolderID="MainContent"

Runat="Server">

<divid="ResultId0"style="background-color:Aqua;"/>

</asp:Content>

and my master page :

<%@.MasterLanguage="C#"AutoEventWireup="true"CodeFile="Site.master.cs"Inherits="Site" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headid="Head1"runat="server">

<title>Mediterrum Works</title>

<linkrel="stylesheet"type="text/css"href="ajax__calendar.css"/>

</head>

<body>

<scripttype="text/javascript"language="Javascript">

function showHideLogo(){

var topbanner=window.document.getElementById('topbanner');

var arrow_top=window.document.getElementById('arrow_top');

if(topbanner.style.display=="none"){

topbanner.style.display="block";

document.images["arrow_top"].src="images/top_arrow_hide.gif";

document.images["arrow_top"].style.height="7px";

}else{

topbanner.style.display="none";

document.images["arrow_top"].src="images/top_arrow.gif";document.images["arrow_top"].style.height="7px";

}

}

function updateTime()

{

var label = document.getElementById('<%= CurrentTime.ClientID %>');

if (label) {

var time = (new Date()).localeFormat(" d/MM/yyyy ");var time = time +" " + (new Date()).localeFormat(" HH:mm ");

label.innerHTML = time;

}

}

updateTime();

window.setInterval(updateTime, 1000);

// Select a collection of CheckBoxList clicking on a CheckBoxList

function SelectAllCheckboxes(spanChk, chbxID)

{

var theBox= (spanChk.type=="checkbox") ? spanChk : spanChk.children.item[0];

xState=theBox.checked;

elm=theBox.form.elements;

for(i=0;i<elm.length;i++)if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)

{

var checkbox = elm[i];

// If a search parameter was passed in

if(chbxID)

{

// Check only thos checkboxes with an ID containing that parameter

if(checkbox.id.search(chbxID) != -1)

{

if(elm[i].checked!=xState)

elm[i].click();

}

}

// No search parameter, just check all checkboxes on the form

else

{

if(elm[i].checked!=xState)

elm[i].click();

}

}

}

</script>

<divid="container">

<formid="navtop"

runat="server"

style="margin: 0px">

<asp:ScriptManagerID="ScriptManager1"runat="server">

<Scripts>

<asp:ScriptReferencePath="WebRequest.js"/>

</Scripts>

</asp:ScriptManager>

<asp:HiddenFieldID="aspHFvisible"Value="true"runat="server"/>

<divid="topbanner">

<tablecellpadding="0"cellspacing="0"border="0"width="100%">

<tr>

<td>

<img

src="images/TerrumWorks.gif"

alt="Semantic Solutions"

style="margin: 0px"/>

</td>

<td>

</td>

<tdstyle="text-align: left">

<imgsrc="images/userOnline.gif"height="16px"width="16px"alt=""/>

<asp:LoginName

ID="LoginName2"

runat="server"/>

</td>

<tdstyle="text-align: right">

<asp:LoginStatus

ID="LoginStatus2"

runat="server"

LogoutAction="RedirectToLoginPage"/>

</td>

</tr>

</table>

</div>

<divid="div-menu">

<tablecellpadding="0"cellspacing="1"border="0"width="100%">

<tr>

<td>

<asp:UpdatePanelID="aspUpdPanGeneralMenu"runat="server">

<ContentTemplate>

<asp:Menu

DataSourceID="SiteMapDataSource1"

ID="Menu1"

runat="server"

CssClass="navmenu"

Orientation="Horizontal"

StaticTopSeparatorImageUrl="~/images/ToolSep.gif"OnMenuItemClick="Menu1_MenuItemClick">

<StaticMenuItemStyle

CssClass="menuitem"/>

<StaticSelectedStyle

CssClass="menuselected"/>

<StaticHoverStyle

CssClass="menuitemhover"/>

<DynamicHoverStyle

BorderWidth="1px"

CssClass="menuitemhover"/>

<DynamicMenuItemStyle

CssClass="menuitem"/>

</asp:Menu>

<asp:SiteMapDataSource

ID="SiteMapDataSource1"

runat="server"

ShowStartingNode="False"/>

</ContentTemplate>

</asp:UpdatePanel>

</td>

</tr>

</table>

</div>

<divid="toolbar"style="clear: both">

<tablewidth="100%"cellpadding="0"cellspacing="1">

<tr>

<tdalign="left"width="15%"style="border:solid 0px black">

<asp:UpdateProgressID="aspUpdProg"runat="server">

<ProgressTemplate>

<table><tr><td>

<imgalt="Please Wait"height="13px"src="images/progressbar_long.gif"/>

</td>

<td>

<asp:Labelrunat="server"Text="Loading ..."/>

</td>

</tr></table>

</ProgressTemplate>

</asp:UpdateProgress>

</td>

<tdalign="left"width="35%"style="border:solid 0px black">

<asp:contentplaceholder

id="ContentPlaceHolderToolbar"

runat="server">

<asp:UpdatePanelID="aspUpdToolBarMessage"UpdateMode="Conditional"runat="server">

<ContentTemplate>

<asp:Image

ID="imgErrorMessage"

runat="server"

ImageUrl="~/images/red-error.gif"

Visible="True"Height="12px"/>

<asp:Label

ID="lblErrorMessage"

runat="server"

Visible="True"

CssClass="ErrorMessage"/>

<asp:Image

ID="imgLblMessage"

runat="server"

ImageUrl="~/images/info.gif"

Visible="True"/>

<asp:Label

CssClass="Message"

ID="aspLblMessage"

runat="server"/>

</ContentTemplate>

</asp:UpdatePanel>

</asp:contentplaceholder>

</td>

<tdalign="center"width="25%"style="border:solid 0px black">

<imgid="arrow_top"onclick="showHideLogo()"alt=""height="7px"src="images/top_arrow_hide.gif"/>

</td>

<tdalign="right"class="rightTable"width="25%"style="border:solid 0px black">

<spanid="CurrentTime"runat="server"class="toolbartime"/> |

<asp:Label

ID="AppVersion"

runat="server"

CssClass="toolbarversion"/>

</td>

</tr>

</table>

</div>

<divid="content">

<!-- Starting region layout for Sample Window -->

<asp:contentplaceholder

id="MainContent"

runat="server">

</asp:contentplaceholder>

<!-- Ending region layout for Sample Window -->

</div>

</form>

<divid="footer">

<tablewidth="100%"border="0">

<tr>

<td>

<address>

<asp:Literal

ID="footeraddress"

runat="server"

Text="<%$ Resources:Resource, FooterCopyright %>">

</asp:Literal></address>

</td>

<tdalign="right"valign="bottom">

</td>

</tr>

</table>

</div>

</div>

</body>

</html>


Hi,

I can't see where in your page is implementing incremental page.

Can you watch the video again and implement a similar feature?

If it still fails, can you provide a simpler page with less elements but include the problem you have?


Additional tip, you can useiFrame to include another form in current page.

TabContainer always hidden

hi there,

my tabcontainer is always rendered as hidden.

this is the asp code

 <td class="text1"> <ajaxToolkit:TabContainer runat="server" ID="TabContainer1" Visible="true"> <ajaxToolkit:TabPanel runat="server" ID="TabPanel1" HeaderText="TabPanel1"> <ContentTemplate> TabPanel1 </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel runat="server" ID="TabPanel2" HeaderText="TabPanel2"> <ContentTemplate> TabPanel2 </ContentTemplate> </ajaxToolkit:TabPanel> <ajaxToolkit:TabPanel runat="server" ID="TabPanel3" HeaderText="TabPanel3"> <ContentTemplate> TabPanel3 </ContentTemplate> </ajaxToolkit:TabPanel> </ajaxToolkit:TabContainer> </td>

and this is how it renders

<td class="text1"> <div class="ajax__tab_xp" id="ctl00_ContentPlaceHolder1_TabContainer1" style="visibility:hidden;"><div id="ctl00_ContentPlaceHolder1_TabContainer1_header"><span id="__tab_ctl00_ContentPlaceHolder1_TabContainer1_TabPanel1">TabPanel1</span><span id="__tab_ctl00_ContentPlaceHolder1_TabContainer1_TabPanel2">TabPanel2</span><span id="__tab_ctl00_ContentPlaceHolder1_TabContainer1_TabPanel3">TabPanel3</span></div><div id="ctl00_ContentPlaceHolder1_TabContainer1_body"><div id="ctl00_ContentPlaceHolder1_TabContainer1_TabPanel1"> TabPanel1 </div><div id="ctl00_ContentPlaceHolder1_TabContainer1_TabPanel2" style="display:none;visibility:hidden;"> TabPanel2 </div><div id="ctl00_ContentPlaceHolder1_TabContainer1_TabPanel3" style="display:none;visibility:hidden;"> TabPanel3 </div></div></div> </td>

can any advise me how to fix this please?

Maurice

it may be obvious to most people but the first div is meant to have the style="visibility:hidden;" but the control is never rendered to the screen, i.e. i cant see the tabs.

Maurice


I've dynamic TabContainer (in code behind), andyourTabContainer.ActiveTabIndex = 0; helped me to solve this issue.


I also have this same problem where the tabcontainer and its tabpanels are always hidden. The HTML markup is all there when you view source of the page but the container and panels have a style attribute of visibility:hidden.

This displays fine in IE6 but under Firefox 1.5.0.12 the tabs are always hidden.

Does any one have any ideas why it does this?


I managed to fix my problem.

The problem was I had a calendar extender control within the tabpanel that had its ondateselection property set. For some unknown reason with that property set, Firefox refuses to display the tabcontainer.

Wednesday, March 21, 2012

tabcontainer by code

i have a ajax tabcontainer

i add tabpanel by code but ,

for example if i have 5 tabs and one is updated content i wanna blink or change the color of tabheader that has been update

Note: that 1 or more tabs can be updated so x tabs must change the color of header or blink

Regards

zulurl

protected void Page_Init(object sender, EventArgs e)
{

AjaxControlToolkit.TabPanel tab = new AjaxControlToolkit.TabPanel();
tab.HeaderText = "test_new_tab";

TabContainer1.Tabs.Add(tab);

tab.Controls.Add(LoadControl("WebUserControl.ascx"));

AjaxControlToolkit.TabPanel tab2 = new AjaxControlToolkit.TabPanel();
tab2.HeaderText = "test_new_tab2" + System.DateTime.Now;

TabContainer1.Tabs.Add(tab2);

tab.OnClientClick = "js";
tab.BackColor = System.Drawing.Color.Red;

{

}

}
with another way how do i refer document.getelementbyid(->the tab added...??
TabID.ClientID

tabcontainer causes my page not to be refreshed

The TabContainer in the following code does NOT refresh my page. Can anybody tell me what's wrong, please?

[My web page works just fine when the TabContainer is removed from the code]

<%

@dotnet.itags.org.PageLanguage="VB"AutoEventWireup="true" %>

<%

@dotnet.itags.org.ImportNamespace="System.Data" %>

<%

@dotnet.itags.org.ImportNamespace="System.Data.SqlClient" %>

<%

@dotnet.itags.org.RegisterAssembly="AjaxControlToolkit, Version=1.0.10123.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"Namespace="AjaxControlToolkit"TagPrefix="cc1" %>

<!

DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<

scriptrunat="server">

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)

TextBox2.text = TextBox1.Text

End Sub

</

script>

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headrunat="server"><title>Untitled Page</title>

</

head>

<

body><formid="form1"runat="server"><asp:ScriptManagerID="ScriptManager1"runat="server"/><div> </div><asp:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate><cc1:TabContainerOnUnload="Button1_Click"ID="ManageVendorsTabContainer"runat="server"Style="position: absolute;

left: 249px; top: 110px;">

<cc1:TabPanelID="TabPanelCreateVendorID"runat="server"><HeaderTemplate>

Create Vendor

</HeaderTemplate><ContentTemplate> <asp:TextBoxID="TextBox1"runat="server"></asp:TextBox><asp:TextBoxID="TextBox2"runat="server"></asp:TextBox><asp:ButtonID="Button1"OnClick="Button1_Click"runat="server"Text="Button"/></ContentTemplate></cc1:TabPanel></cc1:TabContainer></ContentTemplate></asp:UpdatePanel></form>

</

body>

</

html>

Hi,

I tried you code, it works as expected.

Or can you be specific about the issue with you.