Wrox Programmer Forums
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 5th, 2006, 11:59 AM
Registered User
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default usercontrol in datagrid

I have a usercontrol that contains 5 image buttons. These buttons fire a function when clicked. When the usercontrol is used on a page everything works fine.

I need to use the same usercontrol for each row of a datagrid, after quite a bit of investigation and trial and error I have managed to get the usercontrol to display correctly, by using the itemdatabound function below. The problem is that if you click on any of the buttons the usercontrol not only doesnt perform its required function, but they all disapear. That is the page 'relaods' with no sign of the usercontrols!!! I have other functions on the datagrid for sorting and editing and these are all fine. I am getting desperate and would be most grateful for any advice or suggestions.

   Sub dgrdList_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)

      If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then

        Dim uclButtons As Buttons = DirectCast(LoadControl("../includes/buttons.ascx"), Buttons)

         Dim uclType As Type = uclButtons.GetType()

         ctlTxthidden = CType(e.Item.FindControl("txtTitleId"), TextBox)

         panButtons = CType(e.Item.FindControl("panButtons"), Panel)

         Dim strTitle As String

         strTitle = ctlTxthidden.Text

         Dim strButtShow As String

         strButtShow = "st"

         uclButtons.setValues(strTitle, strButtShow)


      End If

   End Sub

Similar Threads
Thread Thread Starter Forum Replies Last Post
loaded usercontrol benordz C# 7 April 4th, 2008 09:16 AM
Get value of a QueryStringParameter in UserControl hpox ASP.NET 2.0 Basics 1 February 16th, 2007 11:54 AM
UserControl in DataGrid kdkcchoco ASP.NET 1.0 and 1.1 Professional 7 January 23rd, 2007 04:38 PM
Datagrid paging in userControl pajer ASP.NET 1.0 and 1.1 Basics 4 October 14th, 2004 03:29 AM
Intellisense for UserControl RNedel ASP.NET 1.0 and 1.1 Basics 6 June 15th, 2004 04:47 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.