Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Popup menu in datagrid

Reply
Thread Tools

Popup menu in datagrid

 
 
Grey
Guest
Posts: n/a
 
      12-23-2004
is it possible to have popup menu designed within datagrid??


 
Reply With Quote
 
 
 
 
R. Thomas, aka Xtreme.Net
Guest
Posts: n/a
 
      12-24-2004
Although I have never tried before, I'd definetly like to try to do that..
You can start off to make a custom datagrid and post questions here to email
to me if you have some problems..
will be glad to help
Regards.
R. Thomas

"Grey" wrote:

> is it possible to have popup menu designed within datagrid??
>
>
>

 
Reply With Quote
 
 
 
 
Igor Stavnitser
Guest
Posts: n/a
 
      12-31-2004
Is there any reason why that would not work?

All you need to do is have your datagrid generate custom javascript to
do transition. I am doing it my application as follows (it is not a
true popup menu but a pop-up row with a menu):

Supporting Javascript:
<script language="javascript">
var shownid;
function showobj(obj) {
if(obj==null)return;
if(obj!=null){
if(shownid==obj) return;
document.getElementById(obj).style.display =
'block';
}
if (shownid!=null)
document.getElementById(shownid).style.display
= 'none';
shownid=obj;
}

</script>


Last columns of the datagrid - CheckOutTS is the actual last field
displayed in the row:
<asp:TemplateColumn HeaderText="Check Out Date"
SortExpression="CheckOutTS">
<ItemStyle Wrap="False"></ItemStyle>
<ItemTemplate>
<%#Databinder.eval(Container.DataItem,"CheckOutTS" )%>
<asplaceHolder Runat="server"
OnDataBinding="PutActions"
ID="Placeholder1"></asplaceHolder>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle Position="Bottom"
Mode="NumericPages"></PagerStyle>
</asp:datagrid>

Now the PutActions excerpts:
Protected Sub PutActions(ByVal sender As Object,
ByVal e As EventArgs)
'Container cell for popup row actions
Dim td As New HtmlTableCell

td.ColSpan = 6 'this number depends on how many columns you
have in your grid
Dim dti As DataGridItem = _
CType(sender.bindingcontainer, DataGridItem)
Dim plc As PlaceHolder = CType(sender, PlaceHolder)
td.VAlign = "Top"
'add actions to pop-up row:
dim lb as LinkButton

LinkButton lb = New LinkButton
lb.Text = "Action 1"
lb.CommandArgument = dbRecord("ID")
AddHandler lb.Command, AddressOf Action1Handler
td.Controls.Add(lb)

LinkButton lb = New LinkButton
lb.Text = "Action 2"
lb.CommandArgument = dbRecord("ID")
AddHandler lb.Command, AddressOf Action2Handler
td.Controls.Add(lb)
'... etc..

'add on mouseover event to row using ID column as unique key
dti.Attributes.Add("onmouseover",
"JavaScript:showobj('actions" & dbRecord("ID") & "');")
'INSERT constructed hidden ROW into DataGrid using ID column
as unique key
plc.Controls.Add(New LiteralControl("</TR><TR id='actions" &
dbRecord("ID") & "' style='Display:none'>"))
plc.Controls.Add(td)
end sub

Now if you are good with JS Menues you can do something much more
sophisticated. With this code I was able to build a cool looking
roll-over effect. I also build my action list dynamically so it is
context sensetive (depending on a row)
It would be interesting to see more posts on this topic!
On Thu, 23 Dec 2004 23:19:10 -0800, "R. Thomas, aka Xtreme.Net"
<NoSpam((E-Mail Removed)> wrote:

>Although I have never tried before, I'd definetly like to try to do that..
>You can start off to make a custom datagrid and post questions here to email
>to me if you have some problems..
>will be glad to help
>Regards.
>R. Thomas
>
>"Grey" wrote:
>
>> is it possible to have popup menu designed within datagrid??
>>
>>
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
2.0 Menu control : Can the dynamic popup menu items be divided into 2 columns instead of 1? Perry Loh ASP .Net Web Controls 0 03-24-2006 04:44 AM
ASP.NET JavaScript Popup, No Popup Using Back Button dapkniht ASP .Net 1 03-08-2006 08:49 AM
Popup Window Popup Timing =?Utf-8?B?Sm9obiBXYWxrZXI=?= ASP .Net 3 11-04-2005 07:33 PM
Popup menu in datagrid Grey ASP .Net 3 12-24-2004 05:33 AM
Main > Popup > Popup > Close popup AND new URL in main? Jens Peter Hansen Javascript 7 06-19-2004 08:56 PM



Advertisments