Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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 December 1st, 2006, 11:29 AM
Authorized User
 
Join Date: Sep 2006
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Got the point ,Mr Mike .But is there any reason to create a grid like this at runtime when we know exactly what are the columsn it contains at design time. I think its better to create the grid at design time ,Then if we need values of main grid ,Better loop through ,and bind it to CHild Grid.I accept any comments

 
Old December 2nd, 2006, 12:57 AM
Authorized User
 
Join Date: Jun 2006
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Friends

Thanks for really very kind response and help.

Mike has defined solution,that's the actual problem of mine.

So I call jaavscript on checkbox.And I got id of that checkbox also.

But When I click on checkbox how I get corresponding value of checked checkbox in javascript?


I am creating Itemdatabound event of my runtime grid as dg_diagnosis

Private Sub dg_diagnosis_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg_diagnosis.ItemDataBound
        If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.EditItem Or e.Item.ItemType = ListItemType.Item Then
            Dim chk As New CheckBox

            chk = CType(e.Item.Cells(0).Controls(0), CheckBox)

            chk.ID = "chk"

            Dim id As String

            id = chk.UniqueID


            CType(chk, CheckBox).Attributes.Add("onclick", "myfun(this.id);")

        End If
    End Sub

Yr Help is really appriciate for me.

Thanks in advance

Monika

 
Old December 2nd, 2006, 01:52 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Monika

No need to create itemdatabound for this grid making your code complex, in place of CheckBox use HtmlInputCheckBox which will provide you both id and value fields, e.g. to add HtmlInputCheckBox to your runtime grid is as below, here on click of checkbox, js will alert the id and value:

Dim chk As HtmlInputCheckBox


                Dim i As Integer
                For i = 0 To dg.Items.Count - 1 Step i + 1
                    chk = New HtmlInputCheckBox()
                    chk.ID = i.ToString()
                    chk.Value = "Val" + i.ToString()
                    chk.Attributes.Add("onclick","alert(this.id + '||' + this.value)")
                    dg.Items(i).Cells(1).Controls.Add(chk)
                Next



Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
 
Old December 2nd, 2006, 08:21 AM
Authorized User
 
Join Date: Jun 2006
Posts: 88
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Mike

Thanks for yr really kind help.It really very helpful for me.

I got my solution through yr help.

Thanks once again.

Monika







Similar Threads
Thread Thread Starter Forum Replies Last Post
Guide on ProgressChange EventHandler of a Browser sachin635 C# 2008 aka C# 3.0 0 September 15th, 2008 04:21 AM
Java without runtime? MOON22 Java Databases 1 October 24th, 2007 04:42 AM
How to get control in runtime. Somesh C# 2005 1 March 24th, 2007 02:23 PM
EventHandler and GDI+ Function Fightfish C# 1 June 21st, 2005 08:02 AM
eventhandler in VBA for Word nesplb Pro VB 6 0 July 30th, 2003 06:26 AM





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