use
RegisterStartupScript
check
http://www.codeguru.com/Cs
Main Topics
Browse All TopicsI have a datagrid that I want to add the following functionallity to:
private void grdItems_ItemDataBound(obj
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingIt
{
e.Item.Attributes.Add "onMouseOver", "this.className='MouseOver
e.Item.Attributes.Add("onC
}
if (e.Item.ItemType == ListItemType.Item)
e.Item.Attributes.Add ("onMouseOut", "this.className='clsItem';
if (e.Item.ItemType == ListItemType.AlternatingIt
e.Item.Attributes.Add ("onMouseOut", "this.className='clsAItem'
}
to allow the selection of one of the rows.
My problem is, without any other controls on the page, how do I get .net to add the __dopostback Javascript function to the page?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
use
RegisterStartupScript
check
http://www.codeguru.com/Cs
i have the same problem. how do i do this?
in my .aspx page i have this: onclick="javascript:__doPo
i have this codebehind
Public Class _default
Inherits System.Web.UI.Page
Implements IPostBackEventHandler
......
....
Sub TittenTei(ByVal eventArgument As String) Implements IPostBackEventHandler.Rais
'HERE I WILL MANAGE THE POSTBACK BUT DONT KNOW HOW
End Sub 'RaisePostBackEvent
But nothing happens. the __doPostBack does not get generated by asp.net
what is wrong?
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Split - bettewen Darth_helge and ihenry
Any objections should be posted here in the next 4 days. After that time, the question will be closed.
lem2802
EE Cleanup Volunteer
Business Accounts
Answer for Membership
by: ihenryPosted on 2005-09-09 at 09:29:28ID: 14853113
If you need to do a postback after clicking a cell in the datagrid, I'd suggest you to add a server control like LinkButton to the datagrid column and apply some css formatting to the control. For example:
"> e; cursor:hand">
l source As Object, ByVal e As System.Web.UI.WebControls. DataGridCo mmandEvent Args) Handles DataGrid2.ItemCommand em Or e.Item.ItemType = ListItemType.Item Then MeBack") Then
<asp:DataGrid id="DataGrid2" runat="server" AutoGenerateColumns="False
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton Runat="server" ID="myLink" style="text-decoration:Non
<%# DataBinder.Eval( Container.DataItem, "iprice" ) %>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
And catch the postback response in ItemCommand event, like so
Private Sub DataGrid2_ItemCommand(ByVa
If e.Item.ItemType = ListItemType.AlternatingIt
If e.CommandName.Equals("Post
' do something here
End If
End If
End Sub
HTH
Henry