I populate grid view from database and shows very nicely, but some data in database has more characters so we trim it and then show it.
now i want that when user move his mouse over the label in grid view it show me all data which is shown in trim i.e 50 chars only
This should happened in client side.
You understand n what I want !
It should shows like Tool tip.
give me answer its urgent please
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
because i used without gridview it works but with grid view it shows first row data as popup for every row in grid view
so what to do ?
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
You need to have that textbox (actually, you should be using a hidden field) in the ItemTemplate of your gridview. Then in your RowDataBound event of the GridView, you can add the attribute to your label to show the message from the HiddenField.
Hope this helps! Please mark the helpful post(s) as Answer.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
If I have understood your problem; On RowDataBound event of your grid, you can write something like this
Protected Sub gvYourGrid_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvYourGrid.RowDataBound
If Not e.Row.RowType = DataControlRowType.Header And Not e.Row.RowType = DataControlRowType.Footer Then
.....
Dim lblYourLevel As Label
lblYourLevel = CType(e.Row.FindControl("lblYourLevel"), Label)
lblYourLevel..ToolTip = "your tool tip message"
.......
End if
End Sub
===============
add the script, and control in your page in your page
Yes i want like tooltip but you simply set tooltip and then used it in javascript.
but i dont want to used tooltip because i have to set lblYourLevel.ToolTip = lblYourLevel.Text
and dont want this because lblYourLevel.Text has trim text (50 chars only) i want to show full text whatever in data base, and it should be shown in proper manner.
and all r done in grid view's label
And also one problem occur in your code , i dont know why but it doesnt fire mouseout for 3rd/5th/4th row of grid view it shows this popup.
Idealy it should disappear but not!
think about this also
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
sameer_wanwe...
Member
33 Points
81 Posts
I want to show whole data as tool tip when cursor is on that label BUt Not tool tip
Oct 12, 2007 12:48 PM|LINK
Prashant Kum...
Star
12334 Points
1992 Posts
Re: I want to show whole data as tool tip when cursor is on that label BUt Not tool tip
Oct 12, 2007 01:33 PM|LINK
You can store the full text in a hidden textbox and display it as tooltip on mouseover of the label.
<asp:label id="label1" .... onmouseover="SetTooltip(this, 'Textbox1')"/>
<asp:TextBox id="Textbox1" TextMode="MultiLine" Text=.... style="display:none"/>
function SetTooltip(obj, id)
{
obj.title = document.getElementById(id).value;
}
You can use the same approach to display the text in a floating div
sameer_wanwe...
Member
33 Points
81 Posts
Re: I want to show whole data as tool tip when cursor is on that label BUt Not tool tip
Oct 12, 2007 01:55 PM|LINK
Tell me in case of grid view .
because i used without gridview it works but with grid view it shows first row data as popup for every row in grid view
so what to do ?
JoshStodola
Star
13736 Points
3177 Posts
Re: I want to show whole data as tool tip when cursor is on that label BUt Not tool tip
Oct 12, 2007 02:07 PM|LINK
You need to have that textbox (actually, you should be using a hidden field) in the ItemTemplate of your gridview. Then in your RowDataBound event of the GridView, you can add the attribute to your label to show the message from the HiddenField.
Hope this helps! Please mark the helpful post(s) as Answer.
sameer_wanwe...
Member
33 Points
81 Posts
Re: I want to show whole data as tool tip when cursor is on that label BUt Not tool tip
Oct 12, 2007 02:15 PM|LINK
Can u please Explain in detail
d_dalapati
Participant
1196 Points
196 Posts
Re: I want to show whole data as tool tip when cursor is on that label BUt Not tool tip
Oct 12, 2007 03:29 PM|LINK
If I have understood your problem; On RowDataBound event of your grid, you can write something like this
Protected Sub gvYourGrid_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvYourGrid.RowDataBound
If Not e.Row.RowType = DataControlRowType.Header And Not e.Row.RowType = DataControlRowType.Footer Then
.....
Dim lblYourLevel As Label
lblYourLevel = CType(e.Row.FindControl("lblYourLevel"), Label)
lblYourLevel..ToolTip = "your tool tip message"
.......
End if
End Sub
===============
add the script, and control in your page in your page
function showHideTooltip() {
var obj = event.srcElement;
var tooltipObj = document.getElementById("tooltip");
var ParentOfObj = obj.parentElement;
with(tooltipObj) {
innerHTML = obj.title;
ParentOfObj.appendChild(tooltipObj);
with(style) {
if(event.type == "mouseleave" || event.type == "blur") {
display = "none";
} else {
display = "inline";
}
}
}
}
<asp:Label ID="lblYourLevel " runat="server" ToolTip="asdf" Text="Label" onmouseover="showHideTooltip();" onblur="showHideTooltip();" onmouseleave="showHideTooltip();"></asp:Label>
<span id="tooltip" style="padding-right: 3px; padding-top: 3px; padding-left: 3px; padding-bottom: 3px;
display: none; font-size: 12px; font-family: Verdana; position: absolute; background-color: #a6bed9; width: 100%; overflow: visible;
border-right: #FFFFFF 1px solid; border-top: #FFFFFF 1px solid; border-left: #FFFFFF 1px solid; border-bottom: #FFFFFF 1px solid;">
JoshStodola
Star
13736 Points
3177 Posts
Re: I want to show whole data as tool tip when cursor is on that label BUt Not tool tip
Oct 12, 2007 04:01 PM|LINK
d_dalapati: you should not use onmouseleave becuase it is IE only. Use onmouseout.
Thanks.
d_dalapati
Participant
1196 Points
196 Posts
Re: I want to show whole data as tool tip when cursor is on that label BUt Not tool tip
Oct 12, 2007 04:15 PM|LINK
Thanks for the correction.
jsearles
Member
337 Points
91 Posts
Re: I want to show whole data as tool tip when cursor is on that label BUt Not tool tip
Oct 13, 2007 03:30 AM|LINK
All you have to do is bind the full text to the ToolTip element of the label (using a template field). I do it all the time - takes no javascript.
ie:
<asp:TemplateField HeaderText="Description" SortExpression="Description">
<ItemTemplate>
<asp:Label ID="lblDesc"
runat="server"
Text='<%# Bind("Description") %>'
ToolTip='<%# Eval("Comments") %>' />
</ItemTemplate>
</asp:TemplateField>
sameer_wanwe...
Member
33 Points
81 Posts
Re: I want to show whole data as tool tip when cursor is on that label BUt Not tool tip
Oct 15, 2007 05:42 AM|LINK
You little bit away of problem statement
Yes i want like tooltip but you simply set tooltip and then used it in javascript.
but i dont want to used tooltip because i have to set lblYourLevel.ToolTip = lblYourLevel.Text
and dont want this because lblYourLevel.Text has trim text (50 chars only) i want to show full text whatever in data base, and it should be shown in proper manner.
and all r done in grid view's label
And also one problem occur in your code , i dont know why but it doesnt fire mouseout for 3rd/5th/4th row of grid view it shows this popup.
Idealy it should disappear but not!
think about this also