Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > How can I get textbox created ID in itemdatabound

Reply
Thread Tools

How can I get textbox created ID in itemdatabound

 
 
Ather Ali Shaikh
Guest
Posts: n/a
 
      09-04-2004
IHi All,

I have a Master grid under this master grid i have child grid in template column. FINE.

but int this child grid i have text box and buttons hard coded. When I bound the grid with datasource it binds. FINE.

On the time binding I add attribute to button to run javascript.

As

mytxtControl = CType(e.Item.FindControl("txtDate"), TextBox )
CType(e.Item.FindControl("btnGet"), Button ).Attributes("onclick","return ImageList(' " & mytxtControl.ID & " ')")
this returns
mytxtControl.ID = nothing
and in view source of html it shows: DGTestMaster:_ctl2GTestDetail:_ctl3:txtDate

I want to pass mytxtControl.ID to popup list against this textboxID

How can I do this.

Regards
Ather Ali Shaikh
 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      09-05-2004
Did you try mytxtControl.ClientID ?

ClientID is the ID that is rendered to the client-side ID attribute and it
is client-script friendly.

If in this case even ClientID doesn't work, try either setting the ID
explicitly in the declarative syntax for the TextBox, if you haven't done
so. If you have already done that, move the code to DataGrid_PreRender, loop
through DataGrid's Items and get the TextBox from each of them (at this
point they have IDs for sure).

If this doesn't seem to help, post the declarative syntax and code for us to
check.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke


"Ather Ali Shaikh" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
IHi All,

I have a Master grid under this master grid i have child grid in template
column. FINE.

but int this child grid i have text box and buttons hard coded. When I bound
the grid with datasource it binds. FINE.

On the time binding I add attribute to button to run javascript.

As

mytxtControl = CType(e.Item.FindControl("txtDate"), TextBox )
CType(e.Item.FindControl("btnGet"), Button ).Attributes("onclick","return
ImageList(' " & mytxtControl.ID & " ')")
this returns
mytxtControl.ID = nothing
and in view source of html it shows:
DGTestMaster:_ctl2GTestDetail:_ctl3:txtDate

I want to pass mytxtControl.ID to popup list against this textboxID

How can I do this.

Regards
Ather Ali Shaikh


 
Reply With Quote
 
 
 
 
Ather Ali Shaikh
Guest
Posts: n/a
 
      09-06-2004
Thank you,
ClientID is working fine.

Regards
Ather Ali Shaikh

"Teemu Keiski" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Did you try mytxtControl.ClientID ?
>
> ClientID is the ID that is rendered to the client-side ID attribute and it
> is client-script friendly.
>
> If in this case even ClientID doesn't work, try either setting the ID
> explicitly in the declarative syntax for the TextBox, if you haven't done
> so. If you have already done that, move the code to DataGrid_PreRender,

loop
> through DataGrid's Items and get the TextBox from each of them (at this
> point they have IDs for sure).
>
> If this doesn't seem to help, post the declarative syntax and code for us

to
> check.
>
> --
> Teemu Keiski
> MCP, Microsoft MVP (ASP.NET), AspInsiders member
> ASP.NET Forum Moderator, AspAlliance Columnist
> http://blogs.aspadvice.com/joteke
>
>
> "Ather Ali Shaikh" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> IHi All,
>
> I have a Master grid under this master grid i have child grid in template
> column. FINE.
>
> but int this child grid i have text box and buttons hard coded. When I

bound
> the grid with datasource it binds. FINE.
>
> On the time binding I add attribute to button to run javascript.
>
> As
>
> mytxtControl = CType(e.Item.FindControl("txtDate"), TextBox )
> CType(e.Item.FindControl("btnGet"), Button ).Attributes("onclick","return
> ImageList(' " & mytxtControl.ID & " ')")
> this returns
> mytxtControl.ID = nothing
> and in view source of html it shows:
> DGTestMaster:_ctl2GTestDetail:_ctl3:txtDate
>
> I want to pass mytxtControl.ID to popup list against this textboxID
>
> How can I do this.
>
> Regards
> Ather Ali Shaikh
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
ASP.NET VB Using ItemDataBound to create textbox in datagrid rows. smi59550 MCSD 0 01-18-2008 09:27 PM
ASP.NET VB Using ItemDataBound to create textbox in datagrid rows. smi59550 General Computer Support 0 01-18-2008 07:42 PM
How to get the TextBox Value in a dynamically created HtmlTable??? Raed Sawalha ASP .Net 2 10-05-2004 06:57 AM
DataGrid write to Textbox in ItemDataBound help. Jay ASP .Net Datagrid Control 0 07-29-2004 05:11 PM



Advertisments