|
Hello All,
I have a <b>datagrid</b> control on webpart, in which I am displaying two out of six columns from a dataset. When somebody click on one row, I want to display all six values for that row on the same webpart without postback. i made this datagrid clickable. i m passing value using the following code.
public void dgSpeakerEvents_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if(e.Item.DataItem!=null)
{
e.Item.Attributes.Add("onmouseover","this.style.cursor='hand'");
e.Item.Attributes.Add("onclick","ShowDetails('"+
DataBinder.Eval(e.Item.DataItem, "TOPIC_NM").ToString()+ "','"+
DataBinder.Eval(e.Item.DataItem, "CITY").ToString()+ "','"+
DataBinder.Eval(e.Item.DataItem, "STATE").ToString()+ "');");
//e.Item.Attributes.Add("onmouseout", "HideTooltip();");
}
}
but when i clicked on datagrid, it shows an error: object expected. i checked in the html source code generated by the browser, values passing correctly.
my javascript function is :
<html>
<body>
<div id=Popup class='transparent'>
<div style='background-color: #003366'>
<b><center><span>VenueDetail</span></center></b>
</div>
<div><table width=100% border=0 cellpadding=0 cellspacing=0>
<tr><td id=td0 align=left class=runtext></td></tr>
<tr><td id=td1 align=left class=runtext></td></tr>
<tr><td id=td2 align=left class=runtext></td></tr>
</table></div>
</div>
<script language=javascript>
function detail()
{
function ShowTooltip(name,city,state)
{
document.getElementById('td0').innerText=name;
document.getElementById('td1').innerText=city;
document.getElementById('td2').innerText=state;
X=event.clientX+document.body.scrollLeft;
Y= event.clientY + document.body.scrollTop + 10;
Popup.style.display='block';
Popup.style.left = X;
Popup.style.top = Y;
}
}
function HideTooltip()
{
Popup.style.display='none';
}
</script>
</body>
</html>
If any body can suggest me with good example.Thanks.
Dhruvil
-- modified at 16:45 Monday 19th June, 2006
|
|
|
|
|
First you should display all the six columns in the datagrid and hide the columns that you don't want to be visible using e.Item.Attributes.Add("display", "none") in datagrid_ItemCreated event. This will ensure that the specific columns will be present in the aspx page, but not visible to the user. You need them to be present in order to be able to show them without a postback.
Then, add a control to the webpage where you will display the hidden columns when the user clicks on an item.
When the user clicks on an item call a javascript function that will read the values from the specific hidden columns and display them in the control.
Your code above for clicking on an item in the datagrid is not correct. Adding an attribute to the datagrid will result in calling the javascript function when the user clicks on the datagrid, and not an specific item in it. You need to add an attribute to each item in the datagrid. See this article[^] as an example on how to create javascript events for items in a datagrid.
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
Hi all
I have an application which search data and it will create a excel file.
Now i want to do is when the user click the button it must create a excel file for data and it has to autometically save on client desktop.
Plz help me
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
You can't automatically save the file on the users desktop. The best you can do is provide the dialog which prompts for saving the file.
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
HI
Thx for reply
There is no other way to save the file in client desktop
Without giving the dialog which prompts for saving the file.
In asp.net or any other language
Thx
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
when we write the E-mail,if we want to choose the accessory,we can press the button to show the dialogbox that we can choose the file.
so,how to show the dialogbox??
thank you!
KSCsoft
|
|
|
|
|
In ASP.NET 2.0, you can use the FileUpload control.
My Blog
|
|
|
|
|
Hi Developers
I watermark an image dynamicaly using VB.net. It was great to seee my company's logo on Product Images BUT I was amazed to see that Watermarked Image size increased almost 10 times.
Original Images Size =60KB
Image size after watermarking=557KB
Image format is .jpg......What I think is that the original image is first converted to Bitmap and then its Watermarked, but its not compressed to .jpg format after watermarking.
Please suggest me anything regarding this, Thanks
Lets work it Out.........!
|
|
|
|
|
Hi Developers
I am trapped in a serious problem. I have developed a site for online Automobiles sales/purchase. You may heard about Autochek which take the VIN(Vehicle Identification Number) and give you the entire history for that Vehicle.
I want to integerate this with my site. The problem is that autocheck provides information about vehicle only if the "request made from the IP of our site". In short i need that Request should be made from website's IP not from client IP.
Thanks in advance
Lets work it Out.........!
|
|
|
|
|
Use a HttpWebRequest object to request the data from the server code, then present it on the page.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks a lot. It realy helped me
Lets work it Out.........!
|
|
|
|
|
I have a field in a drop-down grid that when the user clicks edit, the drop-down box fills with the choices. However I want it to first reflect what the field originally had so I'm trying to create a function that will do that. The field has an id and shows the description. I found some code in VB that does what I need, but the bolded words make the compiler unhappy. I am VERY new to datagrids. How can I reference the specific table and the row that it's on while looping?
public object GetSelIndex (string partCatID)<br />
{<br />
int iLoop;<br />
DataTable dt = dgParts.Tables("PartTypes");<br />
for (int iLoop2 = 0; iLoop2 <= dt.Rows.Count - 1; iLoop2++)<br />
{<br />
if (partCatID == dt.Rows(iLoop)("id"))<br />
{<br />
return iLoop;<br />
}<br />
}<br />
}
|
|
|
|
|
What is the type of the dgParts object? If is a datagrid object, then it does not have any Tables property.
|
|
|
|
|
I am dealing with web application.I want to maintain last visit time of the user.please help me
|
|
|
|
|
You can use Application variables in Session_start event of Global.asax...
Some thing like this
session_onStart()
Application("lastVisitTime")=now
end sub
Lets work it Out.........!
|
|
|
|
|
If you want to maintain the visit of the last user user, as the previous poster suggested, you should use the application object.
If you want to maintain the last visit of every user, you should log that into a database. You can get the current user using HttpContext.User.Identity.Name . If no user is logged in then it will return string.Empty
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
If you are using the ASP.NET 2.0, you might want to see the Profiles which you can persist the last visited date of a user.
|
|
|
|
|
Hi,
Is it possible to put the data from an ObjectDataSource on a Label (and not in a GridView)?
Thanks
|
|
|
|
|
No because the Label control is not a data-bound control. The ObjectDataSource control acts as a data interface for data-bound controls like GridView, FormView, or DetailsView controls.
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
Thank you for your reply.
I fixed it this way:
<br />
string RandomString1;<br />
<br />
RandomString1 = Gridview1.Rows[0].Cells[0].Text;<br />
<br />
Label1.Text = RandomString1;<br />
If you have multiple columns, just make the 0 in Cells[0] to your columnnumber.
|
|
|
|
|
But what if there are more than 1 columns to display? What if the datasource is buld dynamically, what if someone decides to add another two columns? What if the datasource changes frequently?
This is why data bound controls exist. To address these issues.
Of course you can assign the label a value from a source, but you have to do the binding.
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
Simplest way would be to set a border on the bottom and right of the label, a few px wide....
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Anyone can help me to explain the concept base on the code and about this question...-->> How to transfer data from Mobile Wireless Application to Web Application using GPRS in .Net?
[ S.e.L.a.T.a.N'79 ]
|
|
|
|
|
pls use mobile development section for this question.
Nav.
|
|
|
|
|
hi,
we are creating image library using c#
can u plz help me about the topic.................
Uploading(htmlbrows control) Images to a Database, and Retrieving Images from a Database into thumbnail images.All thumbnail images shown in the same page uasing one control i.e,(whenever i click the preview button).
we are using 3-tier architecture
suresh babu.k
-- modified at 0:40 Sunday 18th June, 2006
|
|
|
|