|
You can't force a user to log out, the most (worst) you can do is pop a message box confirming navigation away from the app.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
yes, 
|
|
|
|
|
Hello,
I have written the code below. How do I get the "public List<tbl_objecten_tbl_nen2634> TheList" loaded first?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Bouwgegevens.Gebouwen
{
public partial class Plan : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!ScriptManager.GetCurrent(this).IsInAsyncPostBack)
{
PopulateMenu();
}
else
{
}
}
private void PopulateMenu()
{
List<tbl_NEN2634> allMenu = new List<tbl_NEN2634>();
using (DBBouwgegevensEntities dc = new DBBouwgegevensEntities())
{
allMenu = dc.tbl_NEN2634.ToList();
}
CreateTreeView(allMenu, 0, null);
}
public List<tbl_Objecten_tbl_NEN2634> TheList
{
get;set;
}
private void CreateTreeView(List<tbl_NEN2634> source, int parentID, TreeNode parentNode)
{
int objectID = Convert.ToInt32(Request.QueryString["ObjectID"]);
List<tbl_NEN2634> newSource = (from b in source
join c in TheList
on b.NEN2634ID equals c.NEN2634ID
where b.ParentID == parentID
select b).ToList();
foreach (var i in newSource)
{
TreeNode newnode = new TreeNode("" + i.NEN2634_Code + "" + " " + i.NEN2634_Titel, i.NEN2634ID.ToString());
if (parentNode == null)
{
trvPlan.Nodes.Add(newnode);
}
else
{
parentNode.ChildNodes.Add(newnode);
}
CreateTreeView(source, i.NEN2634ID, newnode);
}
}
}
}
Please help,
Kind regards
Mark
|
|
|
|
|
Hi,
An ASP.net page roughly goes through the following lifecycle:
- init
- load
- Validate
- Render
- Unload
Each has a method you can use to hook in, the signature is of the format protected void Page_Whatever(object sender, EventArgs e) (e.g. protected void Page_Load(object sender, EventArgs e) ). "Events" (e.g.button clicks) happen between Validate & Render.
If I understand you correctly you need to either populate it in init:
protected void Page_Init(object sender, EventArgs e)
{
}
or if you if you are doing something with TheList and controls you'd need to do this in the Page_Load as they aren't initialised until this point.
You might want to take a look at ASP.NET Application and Page Life Cycle[^] it tells you what happens when, though it is a little in-depth and covers the whole call lifecycle, not just the page one. Interesting nonetheless.
|
|
|
|
|
|
I have a windows application which has following elements:
- Toolbar
- Microsoft Word Container
When I click inside Word Container, and tries to click the Toolbar buttons; I have to click twice (one to get out of container) and the other (to call the actual method) behind the toolbar click.
I want to get rid this redundant click, please advise.
|
|
|
|
|
Danish Samil wrote: Microsoft Word Container
And what would this container be? An ActiveX Control or are you using Windows API hacks to host the entire Word application inside the form? If the case is latter, I doubt if you can do it at all.
|
|
|
|
|
I am using Windows API.
Surprisingly toolbar button displays hover effect but the issue is the call to method behind the click - which works by clicking twice as discussed. In addition i tried overriding onmousehover but in vain.
This might give a clue on what to do next.
|
|
|
|
|
I played with this concept once. The issue is that when Word is focused, the form is deactivated. You could use the form activated event but that would fire if you jumped to the form using Alt-Tab. The code shown below detects the WM_Activate message sent to the form and verifies that it was generated by a mouse-click.
private const Int32 WM_ACTIVATE = 0x6;
private const Int32 WA_CLICKACTIVE = 0x2;
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_ACTIVATE && m.WParam.ToInt64() == WA_CLICKACTIVE)
{
Point pt = toolStrip1.PointToClient(Cursor.Position);
if (toolStrip1.ClientRectangle.Contains(pt))
{
foreach (ToolStripItem item in toolStrip1.Items)
{
if (item.Bounds.Contains(pt))
{
item.PerformClick();
break;
}
}
}
}
}
|
|
|
|
|
Thanks a thousand times - it worked.
You Rock!
|
|
|
|
|
I want to develop a search engine like Google, bing. Which are the things are need to implement the search engine. I need some example code snippets.
Thanks
Anand. G
"There is no Limits to think!" 
|
|
|
|
|
This[^] author has written a whole series of articles on creating a custom search engine. It's rather wonderful.
|
|
|
|
|
Thanks Pete O'Hanlon. I already seen that Populating a Search Engine with a C# Spider. I executes the code myself and find that, the problem is the code search the contents within the local server not in a web.
OK. Sir, Can you explain how to use[^] the code to search the contents from the internet.
Thanks.
|
|
|
|
|
I advised you to look at all his articles. This[^] one moved onto web searching.
|
|
|
|
|
To be honest, you probably don't - not unless you have very, very deep pockets. The hardware Google uses to run their search engine consumes between 500 and 680 megawatts of power: about the same as the total output of two or three coal fired power stations. The cost of this alone is staggering, without the cost of the hardware behind it, or repairs to that hardware - and Google replaces a faulty HDD every minute or less...
Find yourself a project that doesn't require such massive storage capacity!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
I agree with you sir. But I need to do with my own hand. I want develop a simple featured text-based search engine.
Thanks
"All fishes know how to swim in sea" 
|
|
|
|
|
Oh Griff!!!, You're turning down a future entrepreneur. If Sergey and Larry had consulted you, we'd not be having Google today 
|
|
|
|
|
At a minimum, you need a server infrastructure that hosts the search page, the crawler, storage, etc.
Crawler
Write a crawler that will hit the home page of the site you're trying to index, extract all the links in the page and recursively crawls each the links and saves the url along with the keywords, images, etc.
Search
Write a search component that will search the indexed pages using the keywords and present the url of the pages to the user.
|
|
|
|
|
Hi, Please help me to convert from "\\r\\n" into "\r\n" .
I am giving input from registry to class i.e. "\r\n" and my code is converting into "\\r\\n". But i need in "\r\n" to get the results.
|
|
|
|
|
Can you show the code in your input?
It is very possible that you have no handle of escaped chars as \r (remember it is ONE char the backslash - called escape - is there to tell you we do not talk about a r as is, but we want to assign to it a special meaning).
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
if (SuffixValue != null)
_RCVData =_SetSerialPort.ReadTo(SuffixValue);
else
_RCVData = _SetSerialPort.ReadLine();
I am doing these things...I am passing "\r\n" to variable SuffixValue but in code its coming \\r\\n.
When i do hard coding instead of variable i.e. "\r\n" then its working fine.
|
|
|
|
|
As I told - when you hard-code the value your IDE handles the escaped characters (convert \r\n to two characters), however when it comes via some port read it still a character sequence of four characters. You have to check your source (port) how it generates the string. maybe teach it to do in C way or add some handling of your own...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
SuffixValue = _deviceSettingsKeys.GetValue("ReceiveSuffix", "");
if (SuffixValue != null)
_RCVData = _SetSerialPort.ReadTo(SuffixValue);
else
_RCVData = _SetSerialPort.ReadLine();
Can you fix this, how i should do this.
|
|
|
|
|
You should do some string replace...
* find escape character (\)
* check if next character has special meaning after escape
* replace the pair with the real one...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
I can do that things whatever you are telling, but here problem is when take harcoded value "\r\n" instead of SuffixValue then its working fine, but when i pass use variable then its not working....can you post any way to do it.
Thanks Kornfeld Eliyahu Peter
|
|
|
|