DataGrid with a menu...

P

Pai

Hello there,

I need to create a Data Grid for an ASP.Net Page which would have all
these feature.

When the user sets focus on one of the colums the column of the Data
Grid it should display a list of menu options to the
right hand side of the column which would have various options for
the menu, but the menu should be smaller then the width of the

Is it possible to trace which column the user has selected? I am also
unable to set the AutoPostBask event for the DataGrid?

Hope somebody has some pointer on this?

Thanks,
Srikanth pai.
 
A

Alvin Bruney [MVP]

Your way forward here is to use the itemcreated or itemdatabound event
handler to embed javascript in the cells using the onmouseover events. You
can add this using attributes. It follows the same pattern as row
highlighting in a datagrid with a mouse over event.
 
S

Srikanth Pai

Hello Alvin,

Thanks for you reply, is it possible for you to kindly guide me to some
site which has embeds javascript in the cells using the mouseover.

I am still unable to understand how the code would understand which
column has been selected in the datagrid, when i placed the datagrid on
the .aspx page i couldnot understand or find any method which would help
me be able to distinguish the columns or rows in the datagrid.

Also I would like to have a "+" sign which would group a set of rows in
the datagrid and "-" which would collapse all the rows and show is it
possible to implement this functionality using data grid or would i have
to use any other control?

I would appreciate if you would guide me in this

Thanks,
Srikanth Pai.
 
A

Alvin Bruney [MVP]

for the plus/- signs, you will need to add a column and set the text to

for the itemdatabound you can use something like this
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
e.Item.Attributes.Add("onmouseover",
"this.style.backgroundColor='lightblue'");


this would put the mouse over for the entire row. if you want fine grain,
you can put the mouseover on a particular cell, which corresponds to a
column in the datagrid. Consider a mouseover event that calls a function
only on column 4

e.Item[5].Attributes.Add("onmouseover", "callMyJavascriptFunction()'");

when the user mouses over cell 4, the event fires and calls
callmyjavascriptfunction. You would be responsible for defining that
function clientside

for the +/- signs, you can add a column to the datagrid and set the text to
a "+" or "-". For both plus and minus, you will need to change the character
set to something like latin-1 - there is a plus/minus symbol in there you
can use as text. The button click would fire the itemcommand event so you
would handle this event to figure out what to do with the code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top