Current Status:
I have a TreePanel and a GridPanel, where the former loads categories and the second articles, both from a database.
Using Visual Studio 2010, Ext.Net 2.5 and C#
The problem:
I'm not being able to make it so when you click in a category (TreePanel node), it does a certain function (in my case I want to fill the articles based on what category was clicked, as the nodes have ID)
I tried to use TreeNodeMouseClickEventArgs but it didn't work (in fact it created a class that has nothing), and since I just started to use this software (and language), I'm stuck.
Thanks a lot in advance.
Edit
The last code I tried was from MS website.
I found a way, and will share it:
On client side
After adding the treepanel, add a DirectEvents
<DirectEvents>
//Calls a function when doing click on a node
<ItemClick OnEvent="yourFunction">
<ExtraParams>
//Loads the nodeID
<ext:Parameter Name="NodeID" Value="record.data.id" Mode="Raw"/>
</ExtraParams>
</ItemClick>
</DirectEvents>
On server side
public void yourFunction(object sender, DirectEventArgs e)
{
//Ask the nodeID
string id = e.ExtraParams["NodeID"];
//Your function goes below
}
Related
I dont know if it is even possible, but is there some way how to "end" page in Windows Phone 8 app?
My problem is that i am using one delegate (to know when is my xml downloaded) on multiple pages. It works fine, but when i open one page, she initialize herself, i go on other page (trough back button) and new page initialize herself too. Everything is fine, but the previous page is still listening to the delegate and it is really big problem. So i need to get the previous page (that closed) into a same state like she was not ever opened.
I will be thankful for any advice (maybe i am thinking in wrong way now, i dont know, maybe the page just have to be de-initialize).
PS: If its necessary i will post the code, but i think it is not. :)
Okey here is some code:
In class whis is downloading XML i have delegate like this:
public delegate void delDownloadCompleted();
public static event delDownloadCompleted eventDownloadCompleted;
This class is downloading few different xml files depends of constructor in run(int number) method.
After is download complete and all information from xml are saved in my local list i call delegateCompled. if (eventDownloadCompleted != null)
{
eventDownloadCompleted();
}
Then i have few different pages. All pages are used for display specific data from downloaded xml. So on this specific page I have method that is fired when "downloadClass" says it is complet.
XML_DynamicDataChat.delDownloadCompleted delegMetoda = new XML_DynamicDataChat.delDownloadCompleted(inicialiyaceListu);
XML_DynamicDataChat.eventDownloadCompleted += delegMetoda;
This is that "inicializaceListu" method:
private void inicialiyaceListu()
{
Dispatcher.BeginInvoke(() =>
{
model = new datka();
// object model is just model where i am saving all specific list of informations that i got from xml files.
chatList9 = model.getChat(1);
gui_listNovinky.ItemsSource = chatList9;
gui_loadingGrid.Visibility = Visibility.Collapsed;
});
}
All of these works fine, but when i go back (with back button) and open other specific page with other specific information from other downloaded xml, previous page is still listening for the delegate and inicialiyaceListu() method is still fired everytime i complete download of xml.
So i need to say previous page something like: "hey page, you are now closed! Can you shut the **** up and stop work?!?"
I think that specific delegate for each pages could solve this, but it is not correct programing way.
I solved it nice and easy. It is really simple solution. I just created bool variable and set it false when i go back. In inicializaceListu() i have condition if it is true. If it is true do that stuffs when false do nothing.
I'm trying to program a delete button that will delete a row when it's selected.
Yet, everything I find on the internet is a bunch of _ _ _ _
I am creating my program on Visual Studio 2010 Professional. Using a MS Access Database
The form contains multiple list-boxes, each with their own piece of the row data.
I can add rows to the table through my programs GUI, but cannot seem to delete them!
I want to delete the selected item, and also to delete all rows on-click of a different button.
Thanks
NOTE: I AM NOT USING SQL BEFORE YOU DECIDE TO GIVE ME ANSWERS IN SQL..
It should look "something" like this:
dbnameDataSet.tableName deltableNameRow;
deltableNameRow = dbnameDataSet.FindByItemID( SelectedItem.lstID );
deltableNameRow.Delete();
this.tableNameTableAdapter.Update(this.dbnameDataSet.tableName);
However, My skills in C# are somewhat limited, so I can only write pseudo for most obstacles.
I have the mind to figure out the problems, but not the library of termanology and understood language to write it myself at the moment.
Please can you figure this out for me.
This is how I currently add items (Working):
dboKanadaDataSet.ProductsRow newProductsRow;
newProductsRow = dboKanadaDataSet.Products.NewProductsRow();
newProductsRow.ProductName = txtItem.Text;
newProductsRow.ListPrice = txtPrice.Text;
this.dboKanadaDataSet.Products.Rows.Add(newProductsRow);
this.productsTableAdapter.Update(this.dboKanadaDataSet.Products);
Any contributions are very welcome.
Muchas Gracias, Merci, Danke, Xie4 Xie4, Thanks!
Josh.
I have found a solution (It's not quite what I wanted, but its working for the task.)
Using the 'Binding Navigator' tool found in the toolbox.
It give the user the following bar:
Then, double-click the 'Save' button and add this code to your form:
private void saveToolStripButton_Click(object sender, EventArgs e)
{
saveRow();
}
public void saveRow()
{
// Created this as a separate function that can be called later
// ... with a simple 'saveRow();' call. (removes code repetition)
// Note: The '55555' and '66666' are to be replaced
// ... by your dataset names (55555) and table name (66666)
this.Validate();
this.55555BindingSource.EndEdit();
this.55555TableAdapter.Update(55555DataSet.66666);
}
To remove items, simply double-click the 'delete' icon and add the following line of code:
{
saveRow();
}
If anyone can help me I'd appreciate it.
I'm working on a C# file in Visual Studio 2010 that I need to be able to test a website with multiple form pages, for the purpose of an example we'll refer to them all as 1.aspx, 2.aspx etc.
I've my code that fills out the first page (1.aspx) fine, and click the "continue" button to load the next page, but when it gets to 2.aspx it won't continue to fill out the form.
We'll say an element on the 2.aspx page is called "DOB". On trying to run from the start (I've all the pages form data in the one .cs file) I get an error like "DOB does not exist in the current context".
Anyone's insight into this would be really appreciated!
In all honesty, it sounds like you might be better off using the WatiN Framework. I have been writing automation with it for years and the way that it is implemented and its ease-of-use make it worth the slight learning curve.
Just to add a bit more to the answer; and yes, this is pseudo-code:
[Test]
public void Should_attach_to_browser()
{
ExecuteTest(browser =>
{
browser.GoTo(NewWindowUri);
browser.Link(Find.First()).Click();
var findBy = Find.ByTitle("New window");
var newWindow = Browswer.AttachTo(browser.GetType(), findBy);
newWindow.Close();
});
}
In the code above, note the Browser.AttachTo(browser.GetType(), findBy); method. Based on what I have understood of your question, the .AttachTo() method would work well since you would be able to take the focus off the current form and assign it to the next in your work/execution flow.
We have to design an interface for a scrum management system as a uni product. However, we are solely interested in the interface. There is zero marking for coding (and we have not in fact used any C#). All we need to do is link the forms (and even this isn't required).
To make the form more readable I have included a tree view. It looks like this:
All projects
- Project 1
- Product Backlog
- Team
- Sprints
- Sprint Backlog 1
- Sprint Backlog 2
- Project 2 etc
On my main interface page, I have linked to each Project, so you can select a project in the tree view and it will bring up a new form (on top of the previous one). This uses the following code:
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
switch (e.Node.Text)
{
case "Project 1":
var newForm = new ProjectInterface();
newForm.Show();
this.Hide();
break;
etc
}
}
This all works okay on the main interface page. However, when I open the new form up to view Project 1, none of the links in the tree view actually work. For example, if I'm viewing Project 1 and wish to view Project 2, the following code (I thought!) should work:
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
switch (e.Node.Text)
{
case "Project 2":
var newForm = new ProjectInterface2();
newForm.Show();
this.Hide();
break;
}
}
Does anybody have any ideas on what I'm doing wrong?
Additionally, please bear in mind the way we are doing this has been set by the lecturer (we are also learning to use Subversion at the same time). Therefore, don't worry about pointing out more efficient ways to do it, just how to link the forms together! Thanks
If you see the main form treelist1 code in the designer and compare it with the copied form designer code, you will notice that this line is missing this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
Add this to the new copied form designer and it should work.
I need to add 2 type of links to existing report with c#. For exapmle:
1) http://www.google.co.il/
2) file:///C:/index.html
I added the links, but only the "http://" works. when I press the link of "file:///" nothing happens.
I've uploaded the full project (very small though) which includes the problem:
http://www.filefactory.com/file/452gsoyymalv/n/ObjectReports.zip
BTW, the "index.html" is a simple 'helloWorld' which loaded successfully when writing the path on the address bar in the browser.
Do anyone knows what additional settings should be set to make the file link work?
*Credit for the sample (without my case):
http://www.c-sharpcorner.com/uploadfile/mahesh/reportviewerobject04172007111636am/reportviewerobject.aspx
AFAIK this is disabled for security reasons - the ReportViewer is NOT a complete browser...
You can try to circumvent that limitation by handling ReportViewer.Hyperlink event yourself... can't try it myself right now, but that's about the only option that can possibly work IMHO...
This is the detailed solution (main idea suggested by #Yahia):
First, I created the event handler:
public void HyperLinkReportHandler(Object sender, HyperlinkEventArgs e)
{
Process.Start(e.Hyperlink);
}
Second, I associated the event handler:
this.rvContainer.Hyperlink += HyperLinkReportHandler;