I have a button on ribbon control.When I click it I open a customization form which shows pivotgrid's fields and I drag items from customization form to the pivot grid but when I close and reclick the button to open the customization form the draged fields are not shown in the pivot.I have to reselect the fields to show on the pivot.
How can I avoid this?
Below code is for button click event.
private void barButtonItem10_ItemClick(object sender, ItemClickEventArgs e)
{
pivotGridControl1.RetrieveFields(PivotArea.FilterArea, false);
pivotGridControl1.FieldsCustomization();
}
The PivotGridControl.RetrieveFields method with your parameters are hiding all fields. If you remove this method from your code, then you will avoid your situation.
private void barButtonItem10_ItemClick(object sender, ItemClickEventArgs e)
{
pivotGridControl1.FieldsCustomization();
}
Related
I want to give the filter button a right click function that when I right click it, it will clear all the grid criteria.
setFilterOnKeypress(false);
setFilterByCell(true);
setFilterButtonPrompt("Left click to filter, right click to clear all texts.");
Button button = new Button();
button.addClickHandler(new ClickHandler()
{
#Override
public void onClick(ClickEvent event)
{
if (event.isRightButtonDown())
{
SC.warn("right clicked");
clearCriteria();
}
}
});
setFilterButtonProperties(button);
This is not working, any ideas on why it isnt working?
Keep the functionality separate. There is no meaning of mixing two different tasks on the same button. Think from the end user's perspective.
Read more on your another post Pass a handler to filter button property that is some what asked in the same context.
I have a tab control with 2 tabs.. When the user clicks on the second tab, it does some validation and then if that validation returns false, the user gets a message indicating to go back. Now, here's my problem, it changes tabs anyways with the code below:
Although the user doesn't see the tab 2, it is showing as changed.
private void tabprincipal_SelectedIndexChanged(object sender, EventArgs e)
{
if (!saved_plan)
{
MessageBox.Show("You need to save a plan first.");
return;
}
How can I avoid this behavior? I want to display the message and the user to remain in the first tab
I think I'm looking for an event prior to the selectedindexchanged to detect that the user clicked tab2 and then don't let him move..
I actually found a way using the Deselecting method of the TabControl
private void tabprincipal_Deselecting(object sender, TabControlCancelEventArgs e)
{
if (!saved_plan)
{
MessageBox.Show("You need to save a plan first");
e.Cancel = true;
}
}
I've a RibbonControl in a mdiform and another RibbonControl added at design time in a MDIChildForm. Then in runtime, I add a RibbonPage, with a RibbonGroup and a BarButtonItem. Like this:
private void MDIChildForm_Load(object sender, EventArgs e) {
BarButtonItem btn = ribbonControl1.Items.CreateButton("Test Button");
RibbonPageGroup group1 = new RibbonPageGroup("Test Group");
group1.ItemLinks.Add(btn);
RibbonPage page1 = new RibbonPage("Test Page");
page1.Groups.Add(group1);
ribbonControl1.Pages.Add(page1);
}
The "Test Page" isn't visible in the MdiParent. But, when I change the active mdi child form, and the ribbon do the merge, the page appears!
It looks like the page isn't merged until I change the active mdi child form.
Am I missing something?
I've found a solution, but I think is not the most elegant way to solve it:
mainRibbon.UnMergeRibbon();
mainRibbon.MergeRibbon(mdiChildForm.ChildRibbon);
A public property to access the child Ribbon was needed.
I have a custom UserControl that displays a modal popup (from the Ajax Toolkit). The control allows the user to add a note to a customer record which the parent page displays in a GridView.
I'm unable to force the parent page to reload the grid after the user clicks the "Add Note" button on the modal popup and closes it. The note is added to the database correctly, but I have to manually refresh the page to get it to display instead of it automatically refreshing when I save+close the popup.
You can use a delegate to fire an event in parent page after note is added to the database.
// Declared in Custom Control.
// CustomerCreatedEventArgs is custom event args.
public delegate void EventHandler(object sender, CustomerCreatedEventArgs e);
public event EventHandler CustomerCreated;
After note is added, fire parent page event.
// Raises an event to the parent page and passing recently created object.
if (CustomerCreated != null)
{
CustomerCreatedEventArgs args = new CustomerCreatedEventArgs(objCustomerMaster.CustomerCode, objCustomerMaster.CustomerAddress1, objCustomerMaster.CustomerAddress2);
CustomerCreated(this, args);
}
In parent page, implement required event to re-fill grdiview.
protected void CustomerCreated(object sender, CustomerCreatedEventArgs e)
{
try
{
BindGridView();
}
catch (Exception ex)
{
throw ex;
}
}
In your case, you can not use any custom event args, and use EventArgs class itself.
On the web page, there is gridview control contains product ID's. bind to a link button.
On ItemCommand event of gridview, I fetch the product information and display in the ajax modal popup extender control. The popup is programatically show on ItemCommand of gridview and also hide programatically.
Now the problem is that, when i close popup after showing first product details and try to see next 1 by clicking on other product ID.., sometimes details are displaye dand sometimes not.
The data comes from database is fetched as well for each product.
Plz help.
I do the same but i have no such problem. So i am pasting code here that may b help full to u.
CODE:
protected void GVallusers_RowEditing(object sender, GridViewEditEventArgs e)
{
try
{
GridViewRow gvRow = ((GridView)sender).Rows[e.NewEditIndex];
populatepanel(gvRow);
ModalPopupExtender1.Show();
}
catch (Exception exc)
{
lblinfo.Text = exc.Message;
}
}
public void populatepanel(GridViewRow gvrow)
{
string userid = gvrow.Cells[0].Text;
lblSite.Text=gvrow.Cells[1].Text;
lblemail.Text = gvrow.Cells[3].Text;
}