Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Javascript and asp.net datagrid controls

Reply
Thread Tools

Javascript and asp.net datagrid controls

 
 
tshad
Guest
Posts: n/a
 
      07-20-2006
I need to do some work with Javascript and my datagrid controls.

I want to do something like:
************************************************** *******
function CheckQuestion()
{
var checkBox = document.getElementById('_ctl0_SecurityStandard');
if (checkBox.checked)
{
dropDown = document.getElementById('_ctl0_SecretQuestion');
dropDown.disabled = false;
textBox = document.getElementById('_ctl0_SecretQuestionText' );
textBox.value = "";
textBox.disabled = true;
}
else
{
dropDown = document.getElementById('_ctl0_SecretQuestion');
dropDown.disabled = true;
textBox = document.getElementById('_ctl0_SecretQuestionText' );
textBox.disabled = false;
}
}
************************************************** *************

The actual names are SecurityStandard, not _ct10_SecurityStandard.

This works fine if I know the actual name of the object.

But in a Datagrid I get something like:

<input id="JobBoardsGrid__ctl2_JobBoard" type="checkbox"
name="JobBoardsGrid:_ctl2:JobBoard" onclick="Javascript:CheckQuestion();" />

and the next row will be:

<input id="JobBoardsGrid__ctl3_JobBoard" type="checkbox"
name="JobBoardsGrid:_ctl3:JobBoard" onclick="Javascript:CheckQuestion();" />

Is there a way to know what object is calling, what the name is and by
that, I could prepend the extra part to the name of all the other objects in
that DataGridItem?

I am setting up the object to call the function from an AttachScript from
the DataGrid
************************************************** *****************
Sub OnAttachScript(sender as Object, e as DataGridItemEventArgs)
if e.Item.ItemType = ListItemType.ITem Or _
e.Item.ItemType = ListItemType.AlternatingItem then
Dim oImageButton as CheckBox = CType(e.Item.FindControl("JobBoard"),
CheckBox)
oImageButton.Attributes.Add ("onClick","Javascript:CheckQuestion();")
end if
end Sub
************************************************** *****************************

Thanks,

Tom



 
Reply With Quote
 
 
 
 
Matt Kruse
Guest
Posts: n/a
 
      07-20-2006
tshad wrote:
> But in a Datagrid I get something like:
> <input id="JobBoardsGrid__ctl2_JobBoard" type="checkbox"
> name="JobBoardsGrid:_ctl2:JobBoard"
> onclick="Javascript:CheckQuestion();" />


I would not use technology that auto-generated javascript code in such a
clueless manner.

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com


 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      07-20-2006
tshad said the following on 7/20/2006 5:55 PM:
> Nevermind.
>
> I figured it out.


No you didn't.

> ....onclick="Javascript"CheckQuestion(this);"


Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
 
Reply With Quote
 
tshad
Guest
Posts: n/a
 
      07-20-2006
"Randy Webb" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed). ..
> tshad said the following on 7/20/2006 5:55 PM:
>> Nevermind.
>>
>> I figured it out.

>
> No you didn't.
>


Actually, I did. I just typed it in wrong.

oImageButton.Attributes.Add ("onClick","Javascript:CheckJobBoard(this);")

This does work.

Tom
>> ....onclick="Javascript"CheckQuestion(this);"

>
> Answer:It destroys the order of the conversation
> Question: Why?
> Answer: Top-Posting.
> Question: Whats the most annoying thing on Usenet?
>
> --
> Randy
> comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
> Temporarily at: http://members.aol.com/_ht_a/hikksnotathome/cljfaq/
> Javascript Best Practices -
> http://www.JavascriptToolbox.com/bestpractices/



 
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
Controls.Count, Controls.IsSynchronized, and Controls.SyncRoot Nathan Sokalski ASP .Net 4 09-05-2007 03:27 AM
Adding Dynamic Controls to a DataGrid for use with the built in DataGrid Edit/Update functionality davidjgonzalez@gmail.com ASP .Net Datagrid Control 1 03-25-2006 06:55 AM
Filling One DataGrid Based on Selection from Another DataGrid - Both in Separate User Controls thegame ASP .Net 1 02-28-2005 04:23 PM
using javascript in User controls to access server controls of the user control Faizan Ahmed ASP .Net Building Controls 1 01-04-2005 04:09 PM
using javascript in User controls to access server controls of the user control Faizan Ahmed ASP .Net Web Controls 1 01-04-2005 04:09 PM



Advertisments