i have a dropdownlist
in codebehind,i have this function
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
///////
}
now i want to show modal popup when a particular text is selected from the dropdownlist from this function
if(DropDownList1.SelectedItem.Text.Equals("Some Text"))
{
ModalPopupExtender1.Show();
}
Related
I need to refresh webView control when the ui size changed. I used SizeChanged event in some controls like Border, WebView, etc SizeChanged event. But I got this system.invalidoperationexception 'a method was called at an unexpected time error. I got this error at the beginning of running the application. The way I used:
<WebView x:Name="webView" SizeChanged="OnSizeChanged" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<WebView.Source>
...
</WebView.Source>
</WebView>
private void OnSizeChanged(object sender, EventArgs e)
{
webView.Reload();
}
Probably I used it in wrong way, or could it be a bug?
I solved the problem when I used Reload method in try-catch:
private void OnSizeChanged(object sender, EventArgs e)
{
try
{
webView.Reload();
}
catch(Exception ex)
{
}
}
After writing a Title in textbox and clicking a button, title changes,
How to change the title font as well?
private void button4_Click(object sender, EventArgs e)
{
string chartTitle;
try
{
chartTitle = textBox1.Text.ToString();
chart1.Titles.Clear();
chart1.Titles.Add(chartTitle);
//chartTitle.Font = new Font("Tahoma",11,FontStyle.Bold); (Not working)
}
catch
{
MessageBox.Show("Error!");
}
}
i am trying too use a tabControl panel to put multiple features in a single form.
how can i make a button inside a tab clickable? it seems as if the button is not active when its being clicked from inside its parent tab.
how can i make the button active from inside the tab container?
notes:
i tryied to place a call for the button inside the tabPage, but then - when i clicked the button nothing happened, but when i clicked somewhere random inside the tab itself the button activity started.
buttons decleration + tabcontrol decleration:
// a button to add the associated views to the right listbox (listbox2):
private void button1_Click(object sender, EventArgs e)
{
listBox2.Items.Clear();
selectedItemText = listBox1.SelectedItem.ToString();
selectedItemIndex = listBox1.SelectedIndex;
foreach(Level lev in levels)
{
if(lev.Name == selectedItemText)
{
pickedLevel = lev;
}
}
foreach(Element view in views)
{
View v = view as View;
if (v.GenLevel != null)//check if the view is indeed a level
{
if (v.ViewType == ViewType.CeilingPlan && v.GenLevel.Name == pickedLevel.Name)//check if the plan is cielling, and if it has the same level as chosen
{
listBox2.Items.Add(v.Name);
}
}
}
dataBindings();
}
// set the listbox1 back:
private void dataBindings()
{
listBox1.DataSource = null;
listBox1.DataSource = levelNames;// string list
}
// button to clear the right listbox
private void button2_Click(object sender, EventArgs e)
{
listBox2.Items.Clear();
dataBindings();
}
// the tab decleration--> what goes here?
private void tabPage1_Click(object sender, EventArgs e)
{
}
i have one window panel in my project.
and i add one button to it.
when i click the button,i want two event to fire.
one event is to hide that window,which i achieve through
Button button = new Button("click");
button.addListener(new ButtonListenerAdapter(){
#Override
public void onClick(Button button, EventObject e) {
hide();
super.onClick(button, e);
}
});
Window.add(button);
and second i want to pop up another window at the same time on the same button click..what to do?
help me out
I think this should solve your problem :
final boolean evenClick = false;
Button button = new Button("click");
button.addListener(new ButtonListenerAdapter(){
#Override
public void onClick(Button button, EventObject e) {
if (!evenClick) {
hide();
super.onClick(button, e);
}
else {
//DO YOUR SECOND CLICK STUFF
}
evenClick = !evenClick;
}
});
Window.add(button);
I make a dialog in which we have some buttons.
on action of one of that button i want to finish dialog.
I don't want to add any command in it.
Please help.
Here is my code.
Form form = (Form) createContainer("/theme", "MYDialog1");
Container container = (Container) findByName("Container", form);
button = new Button(new Command("Close"),i));
try
{
button.setUIID("LabelButton");
}
catch (Exception exception)
{
exception.printStackTrace();
}
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
??????
}
});
container.addComponent(button);
Dialog.show("", form, null);
If you add a command to a dialog it will dispose the dialog by default.
You can manually invoke dialog.dispose() to close the dialog, to get the current dialog just use Dialog dlg = (Dialog)Display.getInstance().getCurrent();
You Don't any relationship between the dialog and the container. Because this reason you can't dispose dialog.
What i understand from your question is that you won't to use command because you want your gui for button.
My advice is to create dialog like that (I think is can be work):
Dialog dialog = new Dialog();
Display.getInstance().callSerially(new Runnable() {
public void run() {
dialog.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
...
dialog.addComponent(dialog);
button = new Button(new Command("Close"),i));
try
{
button.setUIID("LabelButton");
}
catch (Exception exception)
{
exception.printStackTrace();
}
button.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent evt)
{
dialog.dispose();//???????????
}
dialog.addCommand(okCommand);
...
dialog.show();
}
});
this dialog need to be class member to be recognized by button.