|
|
pinTab
Started by AndrewC at 01-17-2007 8:50 . Topic has 10 replies.
 
 
|
|
Sort Posts:
|
|
|
|
01-17-2007, 8:50
|
AndrewC
Joined on 01-11-2007
Posts 23
|
Accessing Tab text from tab page
|
|
|
|
|
Hopefully this will be my last question... ;-)
I need some way to change the text of a tab based on the .rowcount of an ASP.NET GridView control on that tab page. Basically, I need to add the rowcount to the end of the Tab's text.
Is it possible to access the .text property of a Tab in server-side code?
Failing that, is it possible to add client-side script to the main page which hosts the tab, that would retrieve a value from a hidden field and add that value to the end of the text of that tab?
I have tried a few ways to accomplish this, but I can't seem to get it to work completely. I was able to change the tab text in client-side code, but couldn't access either the GridView .Count or the value of the hidden field I put the GridView .Count into.
I even tried using Page.RegisterStartupScript, but that seems to place its script code ahead of the PinTab's startup script, and so I was unable to access the value of the tab's text.
The sooner you can get back to me on this the better, as this is holding up a project for a client...
Thanks,
-Andrew
|
|
|
|
|
Report
|
|
|
|
01-18-2007, 9:34
|
Pintexx Support
Joined on 08-30-2005
Posts 1.574
|
Re: Accessing Tab text from tab page
|
|
|
|
|
Hi Andrew,
this is only possible from client side code.
Just add a hidden input field to your page and set during page_load.
Accessing tab item text should be possible with
// access hidden field
var value = document.getElementById("hiddenValue").value;
// change tab item text for item 1
var item = __objPinTab1.getTabItemByIndex(1);
item.setText(item.text + value);
Regards,
Hans-Peter
|
|
|
|
|
Report
|
|
|
|
01-18-2007, 6:07
|
AndrewC
Joined on 01-11-2007
Posts 23
|
Re: Accessing Tab text from tab page
|
|
|
|
|
OK, I tried that, placing the above code into the tab page, in a function, and calling it from the page's onLoad() event.
I got an error:
"__objPinTab1 is undefined."
??
I should mention that the main page, which has the PinTab control on it, is derived from an ASP.NET 2.0 MasterPage.
I did try the following variations on _objPinTab1, one of which usually works with other controls when using MasterPages:
__objctl00_ContentPlaceHolder1_PinTab1
ctl00_ContentPlaceHolder1__objPinTab1
and I got the same error. I tried looking through the page's source for the actual name of the object, but had no luck - all I saw was __objctl00_ContentPlaceHolder1_PinTab1, which didn't work, as I said above.
Was I supposed to place the code you gave me on the page that hosts the PinTab control? If so, how would I get the value of the Hidden Field from the tab page ?
BTW, I also re-created the page that hosted the PinTab control as a normal ASP.NET page, without the MasterPage; I get the same error about __objPinTab1 being undefined. So it appears the problem is not related to the master page...
Thanks,
-Andrew
|
|
|
|
|
Report
|
|
|
|
01-19-2007, 8:25
|
Pintexx Support
Joined on 08-30-2005
Posts 1.574
|
Re: Accessing Tab text from tab page
|
|
|
|
|
Hi,
__objPinTab1 was a sample.
The name of the tab control at client side is created by
__obj + "".
If your tab controls name is myTab then the name is
__objmyTab.
My understanding was that the hidden field is on the main page.
Is that wrong ?
So, where is this hidden field ?
Regards,
Hans-Peter
|
|
|
|
|
Report
|
|
|
|
01-19-2007, 7:54
|
AndrewC
Joined on 01-11-2007
Posts 23
|
Re: Accessing Tab text from tab page
|
|
|
|
|
OK, maybe I didn't explain well enough.
The page that hosts the Tab control I will refer to as "the main page". The actual name of the Pintab control on the main page is "PinTab1".
The page with the GridView is on Tab #7, and that is where the hidden field is. I will refer to this page as "the tab page".
So, again, the hidden field is on the Tab page, as is the gridview.
In the code-behind (server-side) code, I have access to the number of items in the grid-view. I would like to add that number to the end of the name of the tab.
So: I can get the number of gridview items into a hidden field on the tab page. I need, presumably in client-side JavaScript, to get that text from the hidden field and concatenate it with the text on the tabname.
It all comes down to this: I need to write to the name of a tab, from within the page on that tab.
I hope that makes it clearer...
Thank you,
-Andrew
|
|
|
|
|
Report
|
|
|
|
01-22-2007, 9:12
|
Pintexx Support
Joined on 08-30-2005
Posts 1.574
|
Re: Accessing Tab text from tab page
|
|
|
|
|
Hi Andrew,
yes, it's clear now.
If you are inside a tab item page you can use
parent.objTab
to get access to the internal pinTab object.
This should work:
// get the number from a hidden value
var value = document.getElementById("hiddenValue").value;
// change tab item text for item 1
var item = parent.objTab.getTabItemByIndex(1);
item.setText(item.text + value);
Regards,
Hans-Peter
|
|
|
|
|
Report
|
|
|
|
01-22-2007, 6:39
|
AndrewC
Joined on 01-11-2007
Posts 23
|
Re: Accessing Tab text from tab page
|
|
|
|
|
OK, I get as far as retrieving the hidden value and getting a reference to the tab item. I know I have a reference to the correct tab item because I see its .text value in the Microsoft Script Debugger.
Then, I get an error: "object doesn't support this method." And, from looking in the debugger, there does not appear to be a .setText method on the tab item. Furthermore, I don't see that method in your documentation either. Do I have an older version of the control?
??
I tried this:
item.text = item.text + value;
It doesn't give me an error, but it also doesn't change the text. I tried putting a .refresh() after the above line, too.
Any other ideas on how I can get this to work? If it can't be done, it may prevent my purchasing the control.
Thanks again,
-Andrew
|
|
|
|
|
Report
|
|
|
|
01-22-2007, 10:31
|
Pintexx Support
Joined on 08-30-2005
Posts 1.574
|
Re: Accessing Tab text from tab page
|
|
|
|
|
Andrew,
please download the latest version from www.pintexx.com --> Support --> Fix.
The method you need is setText().
Regards,
Hans-Peter
|
|
|
|
|
Report
|
|
|
|
01-24-2007, 12:04
|
AndrewC
Joined on 01-11-2007
Posts 23
|
Re: Accessing Tab text from tab page
|
|
|
|
|
OK, I downloaded the fix, and it stopped the error in I.E.
Unfortunately, the following line:
item.setText(item.text + value);
gives me the text "undefined" with whatever the value in the "value" variable is. So I worked around that by using the following line:
item.setText("Inventory(" + value + ")";
instead, since I know the Tab will always contain the beginning text "Inventory". This worked in I.E., but now I get an error in FireFox on this line:
item.setText("Inventory(" + value + ")";
The error is:
"item.setText is not a function." Any ideas on how to fix this? Opera and I.E. do not report an error, only FireFox.
Thanks for your patience. I am impressed with the level of your support, and as soon as these last issues are ironed out, I will be purchasing the control.
-Andrew
|
|
|
|
|
Report
|
|
|
|
01-24-2007, 9:48
|
Pintexx Support
Joined on 08-30-2005
Posts 1.574
|
Re: Accessing Tab text from tab page
|
|
|
|
|
Hi Andrew,
could you please clear the FF browser cache ?
There should be no difference between those version.
Possibly FF has still the old version.
Regards,
Hans-Peter
|
|
|
|
|
Report
|
|
|
|
01-30-2007, 12:30
|
AndrewC
Joined on 01-11-2007
Posts 23
|
Re: Accessing Tab text from tab page
|
|
|
|
|
Hans-Peter-
Thank you for your help, I was able to get it working, more-or-less. I believe the problem was FireFox's cache, as you said.
I thought you would like to know I have since purchased the Tab control.
I do have another question, but I will start a new thread for that, as this one is getting long.
Thanks again for all your help,
-Andrew
|
|
|
|
|
Report
|
|
|
|
|
Pintexx Forum » Developer Produ... » pinTab » Accessing Tab text from tab page
|
|
|
|