|
This is driving me crazy. I keep getting the big ugly useless block of text errors and I can't figure out why. Take for example this snippet from my aspx page...
<asp:ImageButton id="ibRoles" runat="server" ImageUrl='<%# GetImageLink("pawn_glass_blue.gif"); %>' CommandName="Roles" AlternateText="Roles" ToolTip="Edit roles"></asp:ImageButton>
You see that I know the name of the image that I want, so I am trying to pass it to a method in my .cs file that will determine the full path to the image, plop the image on filename on the end and deliver it back to the caller. Here is the GetImageLink method...
public string GetImageLink(object imageName)
{
string path = Request.Path.Substring(0,
Request.Path.LastIndexOf("/") + 1 );
return path + "Resources/BlueImages/"
+ (string)imageName;
}
I have tried making the parameter a string and an object. It doesn't matter. The page parser pukes on it every time.
It seems to me that this is fundamental. Why can't I find any examples for this that aren't assuming I am getting my input from a bound database?
Phillip H. Blanton
www.ComponentScience.net
Email: Phillip at that domain that you see one line above the line you are reading now.
|
|
|
|
|
Phillip H. Blanton wrote:
I have tried making the parameter a string and an object
Make it string.
Phillip H. Blanton wrote:
The page parser pukes on it every time.
What errors are you getting ? Have you stepped into the code to see what is passed in and what goes back ?
BTW, you can make your method protected.
Also, use Path.Combine to build a path string, rather than trying to keep track of the /'s yourself.
I do notice in my own codebehind that the semicolon after the method name is not needed - have you tried removing it ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have tried it without the semicolon as well.
this is the error that I get at runtime. No breakpoints are ever hit.
Unhandled error loading module.
DotNetNuke.Services.Exceptions.ModuleLoadException: External component has thrown an exception. ---> System.Web.HttpException: External component has thrown an exception. ---> System.Web.HttpCompileException: External component has thrown an exception. at System.Web.Compilation.BaseCompiler.ThrowIfCompilerErrors(CompilerResults results, CodeDomProvider codeProvider, CodeCompileUnit sourceData, String sourceFile, String sourceString) at System.Web.Compilation.BaseCompiler.GetCompiledType() at System.Web.UI.UserControlParser.CompileIntoType() at System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation() --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean fCreateIfNotFound) at System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath() at System.Web.UI.TemplateParser.GetParserCacheItem() at System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControlParser.GetCompiledType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.UserControlParser.GetCompiledUserControlType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace ---
If I remove the line that calls the codebehind method then the page displays but there is no image of course.
Phillip H. Blanton
www.ComponentScience.net
Email: Phillip at that domain that you see one line above the line you are reading now.
|
|
|
|
|
Could dotnetnuke be the problem ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
He! It quite often is.
I poked around a bit and finally got this to work...
<asp:ImageButton id="ibRoles" runat="server" ImageUrl='<%# GetImageLink("pawn_glass_blue.gif") %>' CommandName="Roles" AlternateText="Roles" ToolTip="Edit roles"></asp:ImageButton>
<asp:ImageButton id="ibEdit" runat="server" ImageUrl='<%# GetImageLink("draw.gif") %>' CommandName="Edit" AlternateText="Edit" ToolTip="Edit resource"></asp:ImageButton>
<asp:ImageButton id="ibDelete" runat="server" ImageUrl='<%# GetImageLink("delete.gif") %>' CommandName="Delete" AlternateText="Delete" ToolTip="Remove resource"></asp:ImageButton>
with this...
protected string GetImageLink(string imageName)
{
return Request.Path.Substring(0,Request.Path.LastIndexOf("/")+1 )
+ "DesktopModules/My_Module/App_LocalResources/" + imageName;
}
I don't know what the original problem was due to the useless error message.
And.. for what it's worth, I am not just combining paths. I am yanking the filename off of the Request.Path and then appending the test of the path to it to get the location of the images.
Phillip H. Blanton
www.ComponentScience.net
Email: Phillip at that domain that you see one line above the line you are reading now.
|
|
|
|
|
I would like to enhance a standrd ToolBar by providing an ownerdrawn Panel for the n-most sub-menu item of which will contain icon images that represent various tools (like the MS Word "AutoShapes" dropdown tool selection Panel). This is easy enough to do.
The problem is on MeasureItem and DrawItem, I only have the object coordinates of the item being drawn relative to "itself" not to the screen or client region (From 0,0 to however big the ownerdrawn button will be). I do not have the "actual" screen coordinates in which the rectangular region is being drawn. If I had the screen coordinates, when the end-user performs a mouse click on the ownerdrawn panel (populated with icon images)...I will be able to determine exactly where inside the ownerdrawn region the user click.
Where on the screen or client area is the menuitem being drawn?
Any help would be greatly appreciated.
-------------------------------------------------------
|0,0 (screen) |
| I need -> ?,? |
| this at ---------------- |
| DrawItem. |0,0 (menuitem)| |
| | | |
| | | |
| | 500,500| |
| ---------------- |
| |
| |
| |
| 1000,1000 |
-------------------------------------------------------
Don
|
|
|
|
|
|
Actually, I've read through most of these ownerdrawn articles and have (I believe) exhausted all possiblities using this approach.
The problem I am having is this; not only to I have to draw a X by Y panel of images for the ownerdrawn ImageItem, I have to be able to determine which image (screen region) has been clicked on. The coordinates that I have availble to be during DrawItem or MeasureItem are the coordinates associated with region that will occupy the MenuItem. That region begins at 0,0 .... not 0,0 the upper left-hand corner of the screen or client area. 0,0 of the MenuItem.
I think the only way I am going to be able to do this is to some how determine where on the screen (or client area) the ownerdrawn MenuItem is being drawn so that I can correlate the Form MouseDown location with the location of the chosen image in the ownerdrawn MenuItem.
The functionality that I am trying to replicate is that of the MS Word "Drawing" tool bar. Specifically, the "AutoShapes" drop down menu, with sub-menus that have image selection panels. I would like to create something like this.
So, my real question is this;
How do I know the screen position that an ownerdrawn MenuItem is being drawn on?
Thanks,
Don
|
|
|
|
|
don ashworth wrote:
so that I can correlate the Form MouseDown location with the location of the chosen image in the ownerdrawn MenuItem.
I may be missing something here. Why don't you just add an event handler to the Click event for the MenuItem?
OK, let's say you want to implement drag functionality--click and hold and drag the mouse to the drawing surface. Yes, I can see this is a problem. But keep in mind that a menu can be activated from the keyboard, which is why you aren't given mouse events for menu items. Of course, a menu that is supposed to select a drawing tool sort of implies you have some sort of a mouse device to the drawing with!
Ugh. I guess if you want drag functionality, the solution is to not use an owner draw MenuItem. MenuItem has a "Select" event which is raised when the menu item is selected (not clicked)--for example, used to display help text about the menu item. From there, it seems you would have to place an owner drawn panel, or something. But you still have the same problem--how do you know the coordinates of the menu item for the Select event?
Nasty problem. Sorry I can't help more!
Marc
My website
Latest Articles:
Undo/Redo Buffer
Memento Design Pattern
|
|
|
|
|
No sweat. Thanks for entertaining the question. Eventhough I do not have a solution yet, I fell better that at least one other person has come to the same conclusion. Looks like I need to write a home grown n-level menu.
Thanks again,
Don
|
|
|
|
|
Hello,
I'm trying to retrieve a page from a webserver, but I keep getting a "The server committed a protocol violation. Section=ResponseStatusLine" error in my program. This is using a the very simple code below:
<br />
string hostURL = "http://patft.uspto.gov";<br />
string URLSuffix = "/netacgi/nph-Parsernetacgi/" + "nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PALL&p=1" + "&u=/netahtml/srchnum.htm&r=1&f=G&l=50&" + "s1=6223224.WKU.&OS=PN/6223224&RS=PN/6223224";<br />
<br />
string lcUrl = hostURL + URLSuffix;<br />
HttpWebRequest webrequest =<br />
(HttpWebRequest)WebRequest.Create(lcUrl);<br />
webrequest.Timeout = 10000;
webrequest.UserAgent = "Code Sample Web Client";<br />
webrequest.ContentType = "text/html";<br />
webrequest.AllowAutoRedirect = true;<br />
<br />
HttpWebResponse loWebResponse = HttpWebResponse)webrequest.GetResponse();<br />
Encoding enc = Encoding.GetEncoding(1252);
StreamReader loResponseStream =<br />
new StreamReader(loWebResponse.GetResponseStream(), enc);<br />
string lcHtml = loResponseStream.ReadToEnd();<br />
<br />
loWebResponse.Close();<br />
loResponseStream.Close();<br />
The problem appears, via HTTP trace, that the server is returning a code "200 Script results follow". I also downloaded the HTTP sniffer from The Code Project (HTTPeep) which did not function (threw off same error). Linux wget chokes as well.
Is there any way to force the program to treat that server code as a "200 OK" code, or to otherwise ignore it?
Thanks in advance,
Colin
|
|
|
|
|
I'm writing a progarm (mentioned in a previous posting) that populate a data grid, via a dataView whose "table" property is a DataTable. I've noticed that whenever I rerun the program, the listing on the dataGrid changes. The records are not loaded in the same order at all. The table is not changed at all, and the DataView.Sort property is set against 3 columns DataView.Sort = "ColName1, ColName2, ColName3";
any suggestions on how I can keep the row index of the DataTable from changing at every app restart?
Thanks
|
|
|
|
|
hi,
Can't you get row Index using this?:
this.dataGrid1.CurrentRowIndex.ToString()
dataGrid1 is a instance of DataGrid,
Regards,
pubudu.
|
|
|
|
|
I can, but since I'm selecting several rows at a time, the currentRowIndex doesn't help me.
|
|
|
|
|
hi,
You can get row index,If you select several rows:-
int a=dataGrid1.VisibleRowCount;
for(int i=0;i<a;i++)
{
if(datagrid1.isselected(i))
messagebox.show("row is="" "+i);
}
<="" b="">
regards,
pubudu.
|
|
|
|
|
Is it possible to use a custom control I made without including the dll along with the executable?
Thanks in advance.
|
|
|
|
|
Plainly not. You can't write code and have it execute on a machine you don't deploy it to.
You can write a custom control in the same project as your executable, then there is no dll.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Yeah but then I cant use the form designer in Visual Studio...
Thanks for clearing this up for me though.
|
|
|
|
|
I am trying to send some message to an embeded device.
its a very simple protocol ,
for example., according to the documentation , When a client send a packet"0x0000", the device reboot, when send "0x0011 0x0001", the device start to
to rotate a certain degree.
I am a newbie to network programming, need a quick example on how to send a packet to a tcp/ip listener.
Thanks a lot!
|
|
|
|
|
Well, it may be self serving, but TransPort is the simplest way.
http://www.componentscience.net/elements/transport
Phillip H. Blanton
www.ComponentScience.net
Email: Phillip at that domain that you see one line above the line you are reading now.
|
|
|
|
|
Hi
I am working for a business company and build software for it as a developer(Web/Win).
But we have familirized ARIS and Rationalrose is told it builds any solution the Enterprise needs in a fast and lower cost using UML and Business Process Models.
My question is :
I will be fired ?
Their Solutions are as Complete as company would not need to me?
|
|
|
|
|
With software services like that, companies are tied to paying expensive consultants to write software how *they* think it should work, then pay the same consultants for maintenance, upgrades, and repairs.
Will you be fired? Haha somehow your whole post seems screwy with almost rhetorical questions written in poor English.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: The Secular Left, the Religious Right, and Prejudice
Judah Himango
|
|
|
|
|
|
I insert an OLe Object into my access DataBase and i found it saves as Pakager i don't understand what Pakager means and i can't retrieve the image from database to use it in my C# codes
plz i need help to write the query stmt for that
thanks
misho
|
|
|
|
|