Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 10th, 2005, 04:42 AM
Authorized User
Join Date: Jun 2003
Location: Lisbon, , Portugal.
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default Datagrid ItemDataBound column widht


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

'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)
            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"))

                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?


Elisa Resina
Elisa Resina

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 07:05 AM.

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