|
Hello there
I'm currently working a datagrid and I would like to add a tooltip with an image if you move the rows. The image is bound to an article id that each row has. My idea is something like this:
Create a method that gets the specific image url for a given article id.
Use e.row.attributes.add to add a javascript that shows the tooltip on mouseover and removes it on mouseout.
Will use the method to pass an argument with the image url to the javascrip
However, after this I'm stuck. I'm having trouble to get a hold of a nice javascript that can take a image url as argument and show it. And I'm not completely sure if I'm on the right way either, especially as the images need to be different and loaded dymically for each row.
Any suggestions what to do?
|
|
|
|
|
An easy way could be adding a tags in the row. And give a title for the tag. That will come as tool tip. It could be something like
<td><a title='<% GetTooltip("YourKey") %>> Your TD text goes here </a>
This won't be the best solution but you can do it very fast instead of going for javascript.
printf("Navaneeth!!")
www.w3hearts.com
|
|
|
|
|
I've just done something similar for the search screens in our web app. Basically on ItemDataBind of the grid, as you say, add an onmouseover handler (no need for a mouseout), pointing to a getImage() javascript function, and in the markup, add a div absolutely positioned, with an img tag inside it.
The js function uses ajax to get the url of the associated image (well, actually, it streams it back, but you get the idea).
Once I have the image (or the url), it's then a simple matter to set display:inline on the div and src= on the image....
"Knock me down, I'll get straight back up again, I'll come back stronger than a powered up pacman"
(Lilly Allen / Kaiser Chiefs)
|
|
|
|
|
Hi all,
I am displaying a datagrid that contains a dropdown list in the 1st column.The user select the operation on the data from the dropdown.For this purpose i wan`t to provide a confirm box for each DDl.
I tried using the following code in the Item DataBound event of the datagrid...
if(e.Item.ItemType == ListItemType.AlternatingItem ||
e.Item.ItemType == ListItemType.Item)
{
DropDownList list=(DropDownList)e.Item.Cells[0].FindControl("DDAction");
list.Attributes.Add("onchange","return confirm('Are u sure?');");
This code gives the dialog box but the postback doesn`t occur if user selects OK and hence the onselectionchanged event on the server is not fired.
How do i go about this???
|
|
|
|
|
Try and set the AutoPostBack property of DDL to true
Mubashir
Software Architect
Storan Technologies Inc, USA
Every job is a self portrait of the person who did it.
|
|
|
|
|
The autopostback is already set to "true".Any other chances..
|
|
|
|
|
Can you paste the html code generated here? so that we can check it...
<< >>
|
|
|
|
|
Here`s the code...
<asp:datagrid id="Status_Results" style="Z-INDEX: 102; LEFT: 24px; POSITION: absolute; TOP: 264px"
runat="server" Width="920px" Height="50px" CssClass="grid" PageSize="5" AllowPaging="True" AllowSorting="True">
<SelectedItemStyle CssClass="grid_selected_item"></SelectedItemStyle>
<AlternatingItemStyle CssClass="grid_alternate_item"></AlternatingItemStyle>
<ItemStyle CssClass="grid_item"></ItemStyle>
<HeaderStyle ForeColor="Black" CssClass="grid_header"></HeaderStyle>
<Columns>
<asp:TemplateColumn HeaderText="Action">
<ItemTemplate>
<asp:DropDownList id="DDAction" runat="server" Visible="False" OnSelectedIndexChanged="DropDown_SelectedIndexChanged"
AutoPostBack="True"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle CssClass="grid_pager" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
CODE
private void Status_Results_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.AlternatingItem ||
e.Item.ItemType == ListItemType.Item)
{
DropDownList list=(DropDownList)e.Item.Cells[0].FindControl("DDAction");
list.DataSource=items;
list.Attributes.Add("onchange","return confirm('Are you sure you wan`t to perform this operation');");
}
}
protected void DropDown_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Write("Hello");
}
|
|
|
|
|
I mean the html code...when user surf the page...view html source...to see why it doesnt not cause post back
<< >>
|
|
|
|
|
Hi all
Is there any way to close sql connection immediatly after fetching data using ExecuteReader method?. I am using 3 tier architecture in asp.net 2.0 with c#.
thanks in advance
sebastian
|
|
|
|
|
Well it depends on your logic, typically after looping through datareader's results you can close the connection.
If you are asking how to close connection, then you can use Close() method under SqlConnection class.
Mubashir
Software Architect
Storan Technologies Inc, USA
Every job is a self portrait of the person who did it.
|
|
|
|
|
Actually, in case of other methods like ExecuteNonquery or ExecuteScalar i can use sqlconnectionobject.close() immediately after execution, in business layer itself. but in case of ExecuteReader i think its not possible as it follows the connected data model. My question is this, whether i can close the sqlconnection in the businesslayer itself, when i am using ExecuteReader and i want to return a value to the presentation layer.
I hope you understood the scenario.
thanks
sebastian
|
|
|
|
|
Yes i got you, but this is not possible with data readers. Data readers comes into 'Connected' approach - meaning you will be connected to the db until you get your last row fetched from the data reader. If you close your connection first, nothing will be returned by the data reader.
I guess you need to use DataSets for this.
Mubashir
Software Architect
Storan Technologies Inc, USA
Every job is a self portrait of the person who did it.
|
|
|
|
|
If you want to close your sql connection as soon as possible you should probably return back a dataset. Once the dataset is populated you could close the connection. You can not close the connection if you are still reading from the sqldatareader.
Ben
|
|
|
|
|
thank you for the reply
Sebastian
|
|
|
|
|
The ExecuteReader method doesn't fetch the data, it only creates the data reader that is used to fetch the data. The data reader doesn't contain all the data, the data remains on the database server until you read it. When you have read all the data you want using the data reader, you can close the data reader and the connection.
---
single minded; short sighted; long gone;
|
|
|
|
|
Actually, in case of other methods like ExecuteNonquery or ExecuteScalar i can use sqlconnectionobject.close() immediately after execution, in business layer itself. but in case of ExecuteReader i think its not possible as it follows the connected data model. My question is this, whether i can close the sqlconnection in the businesslayer itself, when i am using ExecuteReader and i want to return a value to the presentation layer.
I hope you understood the scenario.
thanks
Sebastian
|
|
|
|
|
Dear all,
I my application i am using datagrid,by populating with the xml file my problem is how can i update the xml file i can able to delete but updation i am facing problem can any body can give me the idea so that i can accomplish my task.
thanks and regards,
Subbu.
-- modified at 8:51 Thursday 3rd May, 2007
|
|
|
|
|
That shouldn't be too hard. You can save a dataset as an xml file and replace the copy that you opened. DataSet.WriteXml method to do this.
|
|
|
|
|
Hi,
I have a Asp.Net application in which i have designed a salary slip with datas fetched from the database for each employee in a single form named SalarySlip.aspx. In that i have to print the form inorder to print the salary slip when we click print. For that is there any option in .net? If so pls provide me with source code examples..
Regards
Vijay.
|
|
|
|
|
I suppose that you want to print on a printer connected to the client computer, not to the server? In that case the solution has nothing to do with ASP.NET. Use Javascript:
window.print();
---
single minded; short sighted; long gone;
|
|
|
|
|
Let me know how will it appear if you choose from the combobox by selecting a table name and will it work
Romeo
|
|
|
|
|
What is your question? Try to be more descriptive
Mubashir
Software Architect
Storan Technologies Inc, USA
Every job is a self portrait of the person who did it.
|
|
|
|
|
Please refere the link given below...It will help you
here[^]
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
Hi,
How to disable a specific item present in a dropdownlist!
For example i have a dropdown list with following values:
india
australia
america
now, in the dropdownlist 'india' should be visible but the user should not be provided with a provision to select it!!!!
Gautham
|
|
|
|