How do I know if a tab is selected? - asp.net

I am trying to get a report based on different information located in tabs. How do I know If a tab is selected? I looked for something like:
if(colorListTab.isSelected)
{
}
but no luck! Can you guys help me out with this?

You could use the ActiveTab property, for example(in ActiveTabChanged):
if(TabContainer1.ActiveTab.Equals(colorListTab)){
}
or you could use the ActiveTabIndex:
if(TabContainer1.ActiveTabIndex == 1){ //second tab
}
http://www.dotnetcurry.com/ShowArticle.aspx?ID=178

Try using ActiveTabChanged event
Also please have a look at this question AJAX ToolKit TabContainer: Can I capture the “Active Tab Panel Changing” event

The property you're looking for is "ActiveTab", a property of the actual TabContainer (not an individual tab)
if(colorListTabContainer.ActiveTab.TabIndex == 1)
{
//You only get here if the index of the active tab is 1
}

Related

keyman.setDefaultKeyboardForControl(Pelem, keyboard, languageCode); function is not working with iframe element

It is showing warning that 'keymanweb.setKeyboardForControl' cannot set keyboard on iframes.
I want to manually set specific language of keyman on iframe element.
Please help me out to achieve the same.
While keymanweb.setKeyboardForControl cannot be used with iframes, you should be able to use a controlfocused event event to select a keyboard on entry to the control:
keyman.addEventListener('controlfocused', function(eventProperties) {
if(eventProperties.target == myIframe) {
keyman.setActiveKeyboard(...);
}
return true;
});

Hiding buttons in one web form through another web from in asp.net

I have a problem and it is like that I have two forms in asp.net, In one form I have Button1 one and in another form I have two buttons, Button1 and Buton2 now when I click Button1 in first web form the buttons of other web form should hide, how this can be done in asp.net
Solution1 : You can use Sessions as below on Button_Click Event
Session["DisableButtons"] = "True"
In 2nd page of Load Event you can check as below
if(!IsPostBack)
{
if (Session["DisableButtons"] = "True")
{
btn1.Visible = False;
btn2.Visible = False;
}
}
Solution 2 : You can send a variable's value in the URL when you are doing Response.Redirect and you can fetch from URL using Request.QueryString.
Try using jQuery
$(document).ready(function(){
$("#ButtonID1").click(function(){
$("#ButtonID2").hide() //or .toggle(); if you want to hide/show
});
})
Send values from one form to another form
you can use the logic from here for hiding the contents of webfroms using another either you can use Session .
I don't have enough Reputation else it will be posted in comment
.
Thank you
Udit Bhardwaj

How to copy items from one list box to another list box?

In my web application , I am having 2 List box as "MenuBox" and "UpdatedBox". The MenuBox items were populated from Database using Dataset. Now If I select a Item in MenuBox and Click "Move" button, the selected Item has to be copied to "UpdatedBox".... Can any one tell me how to achieve this ?
ListBox SelectionMode can be set single or multiple, in both cases below code will work
int[] selection = MenuBox.GetSelectedIndices();
while (selection.Length >0)
{
UpdatedBox.Items.Add(MenuBox.Items[selection[0]].ToString());
MenuBox.Items.RemoveAt(selection[0]);
selection = MenuBox.GetSelectedIndices();
}
Hey Try this one this is tested code.
if (ListBox1.SelectedIndex > -1)
{
ListBox2.Items.Add(ListBox1.SelectedItem);
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex);
ListBox2.ClearSelection();
}
Hope it helps you
ListBox2.Items.Add(ListBox1.SelectedItem);
Try this
while(ListBox1.Items.Count!=0)
{
for(int i=0;i<ListBox1.Items.Count;i++)
{
ListBox2.Items.Add(ListBox1.Items[i]);
ListBox1.Items.Remove(ListBox1.Items[i]);
}
}
You can do something like this.
UpdatedBox.Items.Add(MenuBox.SelectedItem);

AJAX Accordion multiple open panels

Is there a way to have two or more open panes on an AJAX accordion control? The page will default to both panes open and user can close pane if desired.
According to the AJAX Control Toolkit description page:
The Accordion is a web control that allows you to provide multiple
panes and display them one at a time
So, no is the answer to your question. You could use Collapsible Panels, which is what the Accordion control is made up of. You can have multiple instances of those visible at one time.
Use the repeater control.
Inside repeater, use accordion.
I want opposite functionality, found out this while fixing someone's code.
First, you need to use this script:
function ToggleAccordionPane(paneno) {
$find('MyAccordion_AccordionExtender')._changeSelectedIndex(-1);
if( $find('MyAccordion_AccordionExtender').get_Pane(paneno).content.style.display == "block") {
$find('MyAccordion_AccordionExtender').get_Pane(paneno).content.style.display = "none";
$find('MyAccordion_AccordionExtender')._changeSelectedIndex(paneno);
}
else {
$find('MyAccordion_AccordionExtender').get_Pane(paneno).content.style.display = "block";
}
return false;
}
Then, modify first header like this:
<Header>1. Accordion</Header>
For second and third pane:
<Header>2. AutoSize</Header>
<Header><a href="" class="accordionLink" onclick="ToggleAccordionPane(2);" >3. Control or Extender</a></Header>
Source:
http://www.c-sharpcorner.com/uploadfile/Zhenia/keeping-multiple-panes-open-in-accordion-web-control/

to set value parent page's frame from popup

I want to set label's value from popup.But label is in frame and I dont know how to achieve it from popup. From parent page,i get this label by following javascript function.
But when I use this function in popup page, I cant find topframe.Do u have any solution about how to success it?
if (window.parent.document.getElementById('lbl'))
{
window.parent.document.getElementById('lbl').innerText = sender.getSelectedItem().get_text();
}
else
{
window.parent.frames['topFrame'].document.getElementById('lbl').innerText = sender.getSelectedItem().get_text();
}
window.parent
refers to your popup-window itself.
Try
opener.frames['topFrame'].document.getElementById()
instead - 'opener' refers to your main-window out of a popup.
window.parent.top.frames.document works

Resources