|
wow superv, solved the problem in one shot
was struggling since morning
thanks a lot , saved my day
greetings
Raj
Rule # 17: Omit Needless Words - Strunk, William, Jr.
-------------------------------------------------------------
Shameless selfplug: Universal DBA | Ajax Rating
|
|
|
|
|
I have a repeater control to display thumbnail pictures. The itemtemplate is made of a web image control. When user clicks on the thumbnail picture, I want it to display a larger image in a web image control and display the image description in a label( the image description is saved in database).
My current code is :
I have a getPhoto function which will get the thumbnail pictures through IhttpHandler and bound to the repeater control.
Then I have a repPhotoG_ItemDataBound function, here I add the javascript to the image html control and call a javascript to pass the thumbnail imagename as parameter and show the large image.
Now, I can get the thubnail picture and display the large images, but I just don’t know how to get and display the image description. Please help!!
private void repPhotoG_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
//finding repeater item Image
System.Web.UI.HtmlControls.HtmlImage img=(System.Web.UI.HtmlControls.HtmlImage)e.Item.FindControl("iPhoto");
//create a relative path for image and add onclick function
img.Src=img.Src.Replace('\\', '/');
string Description="";
string Image;
Image=IMGpath(img.Src);
img.Attributes["onclick"]="showImg('"+Image+"')";
}
function showImg(imgName)
{
imgOn = ("" + imgName);
document.imgLarge.filters[0].Apply();
document.imgLarge.src = imgOn;
hdr.innerHTML=imgName;
document.imgLarge.filters[0].Play();
-- modified at 17:30 Monday 5th June, 2006
|
|
|
|
|
my project is to implement a basic inventory system using an array of structs.
the struct contains an int, itemNumber, and a method, AddItem.
if i create an array of 100 of the structs, it seems to mean i have 100 copies of the method.
i could make the method static but i'm limited to accessing only static members.
i'm wondering if there isn't a better way.
it seems i should keep AddItem in the same struct definition as itemNumber so i can make itemNumbers' access private.
with this scenario:
1) would i have 100 occurrences of AddItem?
2) is there a better approach than what i've outlined?
i appreciate any comments.
thanks.
matt
|
|
|
|
|
I'm really lost on why you have an AddItem method inside the struct. If you want the itemNumber to be read only, just set it in the constructor and have a property with only a getter. If you want to automatically increase the itemNumber, you can have another static number in the struct and when a new item is created, assign the itemNumber to the static number and increase the static number by one.
Last modified: Monday, June 05, 2006 3:23:58 PM --
|
|
|
|
|
mattlove wrote: 1) would i have 100 occurrences of AddItem?
No, the instructions which constitute a given type's methods only exist in one place per AppDomain.
mattlove wrote: 2) is there a better approach than what i've outlined?
Maybe (the context is not defined well enough)
Josh
|
|
|
|
|
The method is not stored in the data of the struct. Not even a reference to the method. Not even if the method is virtual.
If the int is the only data in the struct, the total size of an instance of the struct will be exactly the same as the size of an int, e.g. four bytes.
---
b { font-weight: normal; }
|
|
|
|
|
Hey All,
Not quite sure where I should post this as I'm not really sure what is going on nor can I find anything out there that really helps me with my problem, hence why I'm posting this :\
I have an windows application written in c#. I needed to have the ability to show a certain web page depending on actions taken by the user and I wanted to make it look and feel like the web page was actually part of the windows application so I created a form and added an instance of the Microsfot Web Broswer control to it after having seen an example online using this.
Pretty much everything worked perfectly with it until I went to distribute an installer for the application. The problem is that the installer won't include the Interop.SHDocVw.dll and I have to manually copy this dll to the install folder. A major pain when trying to install this on numerous client machines to say the least. It has no problem with the AxSHDocVw.dll and this is copied in.
I've tried removing and adding the references a number of times. I've refreshed the dependencies to the installer. I've tried to add this dll to the installer manually, both the Interop.SHDocVw.dll and the SHDocVw.dll to no avail. I always get an error message that it is already included in the references, which it is, and the installer build fails.
Can someone please tell me what I need to do to resolve this? Or if not, maybe another way of doing what I'm try to acheive.
TIA,
Brian
|
|
|
|
|
What are you using for the installer, if you're using the one bundled with VS.NET then I think you can just open up a filesystem like view and use the context menus to add the dll, install it to the same directory as the application (as you're doing manually at the moment).
If you're using a "third-party" installer then I'd expect you'd know what you're doing unless there was a wizard provided which built up all the references. If you're using something like NSIS then I'd expect you to know better since you wrote the script .
You know you're a Land Rover owner when the best route from point A to point B is through the mud.
Ed
|
|
|
|
|
Hi:
I'm using codedom to generate source code and I need to generate something like the ternary operator in C# ( ? : ) but I don't know how to do it, I can't find any class in the System.CodeDom namespace to do this.
Thanks
Pablo Hernandez Valdes
|
|
|
|
|
|
friends i m having problem in displaying the form in a loop:
do
{
this.boardRenderer.DisplayBoard(gameBoard);
<other code>
}while(<the game doesnt ends>)
the DisplayBoard function draws on the form but when it is called in from a loop, the main form is not displayed until the processing of the loop is over (END OF GAME IN MY CASE :'( ) how can i make it display the form while processing other code?? PLZZZZ HELP!!
|
|
|
|
|
That is normal, the repaint happens in the same thread. You will need to have a worker thread that draws on the form using delegates.
I am sure there is a tutorial here on code project.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
-- modified at 16:05 Monday 5th June, 2006
|
|
|
|
|
Thanx michel but the thing is i only want to draw the board whenever the player makes a move not randomly so will worker thread be usefull then also?
regards
|
|
|
|
|
|
A link to a very good article on the subject: [^]
Read thoroughly!!!
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
HEY THNX BUDDY.. U ROCK
|
|
|
|
|
|
If the game board really needs to be updated a zillion times a second, then you might want to consider triggering the rendering logic via a Timer. If the frequency of invalidation is not that common, then you might just want to handle the Paint event of a Panel and render the game board there.
Josh
|
|
|
|
|
I have a routine that enables me to update a textbox even when called from a non-ui thread.
delegate void AppendTextCallBack(string text);
private void AppendText(string text)
{
if (this.textBoxStatus.InvokeRequired)
{
AppendTextCallBack CallBackAppendText = new AppendTextCallBack(AppendText);
this.Invoke(CallBackAppendText, new object[] { text });
}
else
{
textBoxStatus.AppendText(text);
}
}
It works just fine, the problem is that I am repeating it and others like it in every single form in my app. I'd like to refactor and have a single function in some common location that all the forms can use. I'd prefer not to create whole new class, but...
Any suggestions?
|
|
|
|
|
Sorry about the code formatting, it looked fine before the post.
|
|
|
|
|
nicknotyet wrote: I'd prefer not to create whole new class, but...
That really limits your options.
You could implement those helper methods as public static members of one of your Form-derived classes, and then call into those methods from the other Forms. But that is weird, because there's probably no justifcation for that one Form-derived class to have the methods, and not some other Form-derived class.
I'd say bite the bullet and spend the extra 6 seconds needed to create a static utility class.
Josh
|
|
|
|
|
Yeah, it really wasn't that much work.
Making it static was the difference as it obviated me of the need to instantiate the class all over the place.
Thanks
NIK
|
|
|
|
|
If the loss of type safety doesn't bother you much, you could factor it out into a generic routine like this
private void MarshalToUIThread(Delegate d, params object[] arr)
{
if (this.InvokeRequired)
this.BeginInvoke(d, arr);
else
d.DynamicInvoke(arr);
}
You would then call it like MarshalToUIThread(new AppendTextCallBack(AppendText), new object[]{text});
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I am working on an app and having issues with my DAL and connectivity. Can anyone suggest a site with a sample app which details how to do this?
Guess this might help... using VS.NET2005 in conjunction with SQL2K5
-- modified at 14:37 Monday 5th June, 2006
|
|
|
|
|
Can you should be more specific about the type of problem you are having? You might get more replies that way.
Josh
|
|
|
|