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 August 10th, 2005, 04:42 AM
Authorized User
 
Join Date: Jun 2003
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid ItemDataBound column widht

Hello,

I need to resize only 2 columns from a datagrid when editing the datagrid. I tried :

Code:
'this event fires once for every row "item" being displayed in a data bound datagrid
        'perda de sessão => novo login
        If Session("cod_fun") Is Nothing Then
            Response.Write("<Script language='Javascript'> alert('A sua sessão terminou, por favor faça novamente o Login !'); window.parent.location.href='http://netserver/Index_AcessoReservado.htm' </Script>")
            Exit Sub
        End If

        'se o item for válido...
        If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
            Dim btnDelete As LinkButton = CType(e.Item.Cells(7).Controls(0), LinkButton)
            btnDelete.Attributes("onclick") = "javascript:return confirm('Tem a certeza de que querer apagar esta linha???')"

            'vou ler a FK da tabela...
            Dim intFKconv As Integer = e.Item.Cells(4).Text
            'Dim intFkconv As Integer = CInt(intFK)
            'VOU PROCURAR A DDL QUE TEM A OPÇÃO QUE QUERO...
            Dim ddl As DropDownList = CType(e.Item.FindControl("ddlE_S"), DropDownList)
            'vou selecionar a entrada correcta na DDL...
            ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(intFKconv))
        End If

        If e.Item.ItemType = ListItemType.EditItem Then
            Dim intFKconv As String = e.Item.Cells(4).Text
            Dim ddl2 As DropDownList = CType(e.Item.FindControl("ddlE_S2"), DropDownList)
            '    'vou selecionar a entrada correcta na DDL...
            If intFKconv = "" Then
                ddl2.SelectedIndex = ddl2.Items.IndexOf(ddl2.Items.FindByText("E"))

            Else
                ddl2.SelectedIndex = ddl2.Items.IndexOf(ddl2.Items.FindByText(intFKconv))

            End If

            e.Item.Cells(5).Width = New Unit("10px")
            e.Item.Cells(6).Width = New Unit("10px") 
       End If
   But nothing changed. Any suggestions?

Thanks,


Elisa Resina
__________________
Elisa Resina





Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid ItemDataBound Event Problem Grahame2003 C# 1 December 3rd, 2011 03:10 AM
ItemDataBound to Grid Within Repeater rstelma ASP.NET 2.0 Professional 4 July 9th, 2008 02:45 AM
Confirm in ItemDataBound rstelma ASP.NET 1.0 and 1.1 Basics 3 December 6th, 2006 02:10 AM
editable datagrid column sarah lee ASP.NET 1.0 and 1.1 Basics 3 September 7th, 2006 02:45 PM
DataGrid ItemDataBound Wyatt70 ADO.NET 2 November 22nd, 2004 03:31 PM





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