In my windows phone application one profile page is there.in this profile page profile,changepassword,orders and cash pivot items are there.
Whenever I click changepasswordbutton then page will navigate from mainpage to profile page always go to profile pivot item only.
I want to go to changepassword pivotitem. How will solve this problem? please help me....
private void changepassword_Click(object sender, RoutedEventArgs e)
{
Frame.Navigate(typeof(profile));
}
You can set the pivot control's SelectedIndex property to switch to a distinct pivot item within the page. For example, if changepassword is the third pivot item, you'd set
PivotControl.SelectedIndex = 2
If this shall be done directly after loading the page (e.g. because you just navigated to the page containing the pivot control), I'd run this code within the page's OnNavigatedTo method.
Already answered by stack overflow for this question
Question
Frame.Navigate(typeof(profile), 1);
In your profile page:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
MainPivot.SelectedIndex = (int) e.Parameter;
}
Hope this will help you..
Related
Hi all I was designing web application in that i have two master pages Default.aspx and Addregistration.aspx in addregistration i stored the data in database using SQL and i display data in default page as a gridview and I made my column as hyperlink in grid view when I click that link it should go to addregistration page how I store the data with fields and text what I type.Below is the Css for column
Handle it by javascript. Your NavigateUrl is #, and add an onclick event, Or just use an input type button to make it easier
<asp:HyperLink ID="hlink" CssClass="control" runat="server" NavigateUrl='#' onclick="gotoRegistration(<%#Bind("ReferenceNo")%>)" Text='<%#Bind("ReferenceNo")%>'></asp:HyperLink>
try there to pass the ReferenceNo to the JS function, if Bind doesn't work, try Eval.
and your JS
<script>
function gotoRegistration(theRefNo)
{
theUrl = "~/AddRegistration.aspx?refNo="+ theRefNo
window.location = theUrl;
}
</script>
And then your Registration page read it from Query of the Request
Use the Page.PreviousPage Property to get data or access controls at Default.aspx from Addregistration.aspx
sample code in Addregistration.aspx:
protected void Page_Load(object sender, EventArgs e)
{
Page.PreviousPage.FindControl("hlink")
}
Scenario:
I have a ASPX (with no form element) let's call it Page A, the form contains a DIV that displays a ASPX page with a FileUpload Control in a form element, Page B.
Requierment:
Submit the form to upload the file, without Page A refreshing or navigating out and displaying the result of the upload in the DIV or Page B.
Problem:
When I hit the submit button to upload the file, the file uploads and Page A turns into Page B.
Any suggestion will be very appreciated.
Thank you,
You can use PreviousPage to do this.
1) Create a property in Page A to expose the file name o something else that you need to expose in Page B, for exemple:
public string FileName
{
get { return fileUpload.FileName; }
}
2) On the submit button event in Page A redirect to Page B
protected void btn_Click(object sender, EventArgs e)
{
/*Save file here*/
this.Server.Transfer("~/PageB.aspx");
}
3) Add the directive in Page B aspx that tell which page is the PreviousPage:
<%# PreviousPageType VirtualPath="~/PageA.aspx" %>
4) Use the public property in Page B to show the result to the user, for exemple put it in a label:
Label1.text = this.PreviousPage.FileName;
Hopes this help! Take a look here for more info: How to: Pass Values Between ASP.NET Web Pages
I have a database that I need to turn into a list for a webpage. I have the data bound to a gridview in the page_load function of a behind code file. I was wondering how I could take my grid data and create a ul/li list with it. Here's my function so far:
protected void Page_Load(object sender, EventArgs e)
{
Service1 myService = new Service1();
//Use a gridview to store the table data before building the menu
GridView sites = new GridView();
sites.DataSource = myService.GetAllSites();
sites.DataBind();
foreach (GridViewRow siteRow in sites.Rows)
{
String itemName = siteRow.Cells[1].Text;
}
Also, does anyone know how to make a list expandable? So that clicking one list item will cause a div or something to open right below it, moving the list items down a bit to make room?
What you've described sounds very close to the asp.net TreeView control
http://msdn.microsoft.com/en-us/library/d4fz6xk2(v=vs.80).aspx
Adding to the tree:
treeView1.Nodes.Add(new TreeNode(site.Name));
A pretty easy to follow example here:
http://www.nullskull.com/q/10328363/treeview-in-aspnet-with-examples.aspx
I have a mainpage with a Button with some content. I want to open a second page or popup in witch i must have a longlistselector with X items in it. when i choose one of them i want to change the content of the button to the selected item.
I can make the main page and the second page i dont know how to send back the result to the first page. ?
if you are using "MVVM Light" library then you can use Messenger service Like this....
in second page after selection is changed send a message
Messenger.Default.Send<type>(message,token);
and then in the consructor of page 1 viewmodel
Messenger.Default.Register<type>(this,token,Method);
here token should be same as sender token....
then
void Method(type message)
{
button.content = message;
}
Use Popup to show your LongListSelector ,and when set popupElement.IsOpen=false; the set Button Content same as required,
If you wish to change content as selected list then use popupElement.IsOpen=false; on selection change method and get selected item there.
Remember use selection change method on page not inside popup child class.
If you are using a separate page to show the longlistselector, then you could try something like this.
//in long list page,
Void longlist_SelectionChanged()
{
PhoneApplicationService.Current.State["key"] = longlist.selecteditem;
NavigationService.GoBack();
}
//in your main page where the selected data has to be displayed..
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
if(PhoneApplicationService.Current.State.ContainsKey("key"))
{
Button.Content = PhoneApplicationService.Current.State["key"];
}
}
I am using JTabbedPane with JPanel to display JTable on one tab and text, dropdown and jbutton on other tab.
First time it is working fine but if i minimize or switch screen to other application and come back to my application it display data correct but with a serious problem with tab change in JTabbedPane. Now tab screen goes to blue and don't display the data.(I hope data is there but it is not repainting or refreshing complete window).
Now with blue screen i do the same procedure and change tab in JTabbedPane it shows correct data.
I used repaint but it doesn't work.
Help needed to refresh window or tab correctly.
It may problem of Browser you are using jdic.dll. Try using any other browser to reload your tabbed pane.
I guess this "issue" is an evergreen. I assume, that most people stumble over this issue possibly when implementing JTabbedPane changes (removing and adding of tabs) in the wrong event-method:
For example, if you want to remove a tab and add a new one in the tabbed pane based on a selection in a JComboBox, you have to put your logic into an 'itemStateChanged'-event of the ItemListener added to this combo-box. If you put your tab-change-logic e.g. into an propertyChangeEvent (PropertyChangeListener), you are doing it all wrong and the timing is always messed up for repainting/refreshing tabbed pane UI elements!
If you use the right event-method, you don't even have to call setVisible, revalidate nor repaint. It will all work out perfectly.
Here's a simple example:
JComboBox<String> c_editor = new javax.swing.JComboBox<String>();
c_editor.setModel(new javax.swing.DefaultComboBoxModel<>(
new String[] { "CSV", "EXCEL", "HTML" }
));
c_editor.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
c_editorItemStateChanged(evt);
}
});
...
protected void c_editorItemStateChanged(ItemEvent evt) {
// get the value selected in the combo box
final String val = c_editor.getSelectedItem().toString();
if (tabbed_pane.getTabCount() > 1) {
// remove the panel which is at position 1
tabbed_pane.removeTabAt(1);
}
if (val.equals("CSV")) {
// add the panel for viewing CSV files
tabbed_pane.addTab("CSV Editor", p_csv);
} else if (val.equals("EXCEL")) {
// add the panel for viewing Excel files
tabbed_pane.addTab("Excel Editor", p_excel);
} else if (val.equals("HTML")) {
// add the panel for viewing HTML files
tabbed_pane.addTab("HTML Editor", p_html);
}
}
That's all, nothing else necessary - the UI will update itself. PS: This issue has nothing to do with browsers as suggested by the 'favoured' answer in this thread, it's all about Java Swing GUI's.