Hi im using the RadToolTip.
<asp:Image ID="imgMain" runat="server"/>
<telerik:RadToolTip ID="RadToolTip2" runat="server" TargetControlID="imgMain" Width="400px" RelativeTo="Element" EnableShadow="true" Position="BottomCenter" Animation="Slide" AnimationDuration="300" ShowDelay="200" Skin="Vista" HideEvent="LeaveToolTip">
</telerik:RadToolTip>
Im also adding a Image inside the RadToolTip at runtime, the ImageUrl of this Image is set via my own custom Image Handler which is used within the site and works fine.
When the user hovers over 'imgMain' the RadToolTip should show the same image but at a different size, but all im getting is the RadToolTip showing the title.
If i hard code the Image Urls into the Image inside the RadToolTip is shows fine so i know its not a problem with my ImageHandler.
Is there any known issues with dynamically showing images from a Image Handler inside a RadToolTip?
My Server side code is below
imgMain.ImageUrl = String.Format("~/dbimagehandler.ashx?record=product&empty=showt&imageno=1&recno=-1&wid={0}&hgt={1}&productid={2}", "188", "196", this.ProductId)
imgMain.AlternateText = ds.Ds.Tables["Table"].Rows[0]["Title"].ToString();
imgMain.ToolTip = ds.Ds.Tables["Table"].Rows[0]["Title"].ToString();
RadToolTip2.TargetControlID = imgMain.ID;
Image imgsmall = new Image();
imgsmall.ImageUrl = String.Format("~/dbimagehandler.ashx?record=product&empty=showt&imageno=1amprecno=-1&wid={0}&hgt={1}&productid={2}", "376","392", this.ProductId);
RadToolTip2.Controls.Add(imgsmall);
Any help on this would be much apreciated.
In what event are you adding this image to the tooltip? If it is in an AJAX request make sure that the tooltip is updated as well. You can also check the net tab to see if the request for your image actually returns an image and not 404, which would be a very good reason for a missing image.
You can also try putting an image in the markup and setting only its url from the server, or even via JavaScript on the client (for example in the OnClientShow event, by storing the URL in a hidden field).
You can also take a look at the Load-on-demand the RadToolTipManager offers, for example form the telerik demo site, for example here, as it would fit very nicely with the way you dynamically create an image.
Not sure if you already are doing so but make sure that you have following kind of code in your code behind ( I use C# )
private void LoadTree()
{
RadToolTipManager1.ShowDelay = 100;
RadToolTipManager1.HideDelay = 100;
RadToolTipManager1.AutoCloseDelay = 8000;
RadToolTipManager1.TargetControls.Add("<ID Of the Control where you wish to diplay the rad tool tip>");
}
This might help. I noticed some funky behavior with the RadToolTips after some recent updates...so I went to a RadToolTipManager with an Ajax update. Just put your handler code in the Ajax event.
http://trappedinhoth.blogspot.com/2014/05/fixing-teleriks-radtooltip-after-latest.html
I hope that helps.
Related
I have the following scenario.
User is trying to update the profile image , I am using uploadify plugin to upload image to server , and in callback I am setting
<img src="" runat="server" class="user-image" id="uploadedImage" />
SRC attribute to the uploaded path. This part is working good , then when user clicks on Save button , i need somehow to get new picture path and save it to database.
user.ImageUrl = this.uploadedImage.Attributes["src"];
doen't brings a new picture path , and returns a previous path.
Can someone help pls ?
If you want to accomplish this you may use using hidden field, among other ways.
Please refer to: http://www.codeproject.com/Articles/603102/Persist-JavaScript-changes-on-postback,http://forums.asp.net/t/1428896.aspx/1,http://forums.asp.net/t/1285473.aspx.
I am trying to build SPGridView on aspx.cs
Below is the code
StringBuilder sb = new StringBuilder();
sb.AppendFormat("<SharePoint:SPGridView runat=\"server\" ID=\"spgridview\" AutoGenerateColumns=\"false\" AllowPaging=\"true\" AllowSorting=\"true\" Visible=\"true\">\n");
sb.AppendFormat("<Columns>\n");
sb.AppendFormat("<asp:TemplateField>\n");
sb.AppendFormat("<ItemTemplate>\n");
sb.AppendFormat("<asp:Label ID=\"lblNo\" runat=\"server\" Text=\"First\"/>\n");
sb.AppendFormat("</ItemTemplate>\n");
sb.AppendFormat("</asp:TemplateField>\n");
sb.AppendFormat("<asp:TemplateField>\n");
sb.AppendFormat("<ItemTemplate>\n");
sb.AppendFormat("<asp:Label ID=\"lblName\" runat=\"server\" Text=\"Janaki\"/>\n");
sb.AppendFormat("</ItemTemplate>\n");
sb.AppendFormat("</asp:TemplateField>\n");
sb.AppendFormat("</Columns>\n");
sb.AppendFormat("</SharePoint:SPGridView>\n");
I tried Response.Write(sb.ToString());, There is nothing on the page. How can I get this working. Maybe I am missing something..Please let me know.
You cannot dynamically render controls this way; this is not supported, and will render as plain HTML. You have to have them statically defined on the page, or load them by adding them to the controls collection or a parent control.
Everything in your string builder is a Server Side control. This means that if you try to write it out when rendering the page, you will get nothing at best or get an error at worst since the browser has no idea what a .NET control is.
If you want to add controls from the code behind you will need to use Page.Form.Controls.Add() or something similar to do it.
Based on your code it seems like you could just include the contents of your string builder in the aspx page and set Visible to false or true depending on your needs.
I have an ASP.NET web app. What I am attempting should be simple: after an image is displayed, I have a Rotate button which should allow the user to rotate the image 90 degrees. Here is the button click code...
Dim i As Image
i = Image.FromFile("C:\Inetpub\wwwroot\myWebApp\MyImage.jpg")
'rotate the picture by 90 degrees
i.RotateFlip(RotateFlipType.Rotate90FlipNone)
're-save the picture as a Jpeg
i.Save("C:\Inetpub\wwwroot\myWebApp\MyImage.jpg",System.Drawing.Imaging.ImageFormat.Jpeg)
'tidy up after we've finished
i.Dispose()
The image and button used here are non-remarkable. When I created a sample app with just 1 page this works perfectly. However, when I put in into my main app, even if its in a new page, all by itself with nothing else, not even a masterpage, it does, in fact rotate the image and write it back to the file system, but it doesn't show the rotated file. It shows the image as it was. UNTIL I hit F5, then, no matter how many times I hit the button, it works perfectly. I have tried eveything i can think of to clear the cashe to no avail.
Are you re-requesting the image using an update panel or some other mechanism? You will be able to force a refresh by putting something like a timestamp or similar GET parameter on the IMG src, or in the ASP:Image source.
Instead of saving the image back to the web root you can keep the original image as is and just stream the rotated image to the client.
<img src="RotateImage.aspx?Image=MyImage.jpg&Rotate=90" />
and then in your RoateImage.aspx do the same load/rotate work and:
i.Save(Response.OutputStream, ImageFormat.Jpeg)
Response.ContentType = "image/jpeg"
The image is served from the cache, that is why it is not shown updated. To show the newer version of the same image. You may attach a query string to the path of the image. For example,
<img src='/images/image.jpg?<%= DateTime.Now.Ticks %>' />
In my asp.net web app, I create a popup window with a button. When that button is clicked, I want to set the value of an asp:TextBox (id=TextBox1) contained in the parent window. However, it doesn't work like all the examples I've read indicate.
I've tried the following lines of code in my javascript onclick handler:
window.opener.document.getElementById('<%= TextBox1.ClientID %>').value = "abc";
window.opener.document.getElementById("TextBox1").value = "abc";
window.opener.document.getElementById("ctl00_ContentPlaceHolder1_TextBox1").value = "abc";
Only example 3 works. All the stuff I've read indicates that #1 is the preferred method, but I can't seem to make it work at all. Does anyone have any ideas what I'm doing wrong?
I've tried this in Firefox, Chrome and IE.
Thanks
you need to change a bit when calling your popup code , you have to pass your textbox client id and then you can set its value from popup page without any hard codding.
here is the way :
var txtNameClientObject = '<%= txtName.ClientID %>';
window.open('Child.aspx?txtName='+txtNameClientObject);
and then in popup page you can do it as
opener.document.getElementById('<%= Request["txtName"] %>').value = 'from child';
hope this will be helpful for you.
Thanks
Is this line of JavaScript contained in the markup for the popup window itself? If so, the server-side code for that won't be aware that TextBox1 exists on the server-side code for the parent window, and won't be able to determine its ClientID property. You either need to pass that client ID to the popup window somehow (querystring, cookie, session, whatever) or hard code it. Alternatively, you may be able to put this line of JavaScript in a function on your parent page, and then call something along the lines of window.opener.functionName().
My requirement is to have database based help system for asp.net website, as shown in the image below. i have searched web but could not find even remotely related solution.
DNN Help System http://img3.imageshack.us/img3/6720/dnnhelpimage20091125.jpg
You could assign each help item a unique ID (perhaps GUID to make it easier to generate by the developer enabling help for that item).
Clicking on the link opens a dialog, tooltip, new window, whatever. Just have the UI load the help text by ID from the database.
To make this easier to implement in the UI, there are a few ways. Perhaps you can create a jQuery client-side behavior.
your HTML would look something like:
<span class="help" id="#{unique-id-here}">Admin</admin>
and you could have jQuery on DOM load:
$(function() {
var help = $(".help");
help.prepend("<img src=\"path/to/images/help.png\" />");
help.click(function() {
//do something with this.id; open a popup, a title bar, whatever.
}
});
We did it on our site by doing the following:
We have a HelpTopics database with a HelpTopicId and HelpTopicText
We create an aspx page that displays the HelpTopicText based on the HelptopicId passed in the querystring.
We set up a css class for the A tag that displays the link to the help with the question mark image.
We created a UserControl named TitleandHelp that contained a link to the page mentioned in step 2 and the style for the link set to step 3 above: The usercontrol has a public rpoperty for the title and one for the topicID (We called it HelpContext).
We add the usercontrol to the aspx page where appropriate
<uc2:titleandhelp ID="titleandhelp1" runat="server" HelpContext="4" PageTitle="Forgot Password" />
it may sound like a lot of work, but really it only takes a half hour or so to do all of the setup. The rest of the work lies in populating the table and dragging the usercontrol onto the pages where appropriate.