Hiding a control using JavaScript depending on value in cell of Infragistics Ultrawebgrid


I want a text box to be hidden if value of cell is 'NO', if user chooses 'YES' then the text box must be visible. The Yes/No option is a selection in a cell of an Ultrawebgrid. I am using a valuelist to load them.

This is done in Visual Studio 2010 C# environment.

Your assistance will be greatly appreciated.

Who is Participating?
MrunalConnect With a Mentor Commented:
If the textbox you are trying to access is inside the grid then you can not access it directly.
Because you will not have access directly by accessing "txtOthers.ClientId".

Try this:

you are getting proper/correct value in "value" variable:
var value = activeRow.getCell(7).getValue();


Solution- without jquery:
1. After grid is rendered on browser, through developer toolbar, check what is client id rendered for that textbox in grid.

2. Take that is as it is and put like:

document.getElementById("textbox_clientid_here").value = "no";

solution: with jquery:
1. Add reference for jQuery javascript file.

2. Add following code, instead of already present code:
(just one line)

document.getElementById("<%=txtOthers.ClientID%>").value = "no";



document.getElementById("<%=txtOthers.ClientID%>").value = "yes";



If this not worked then please share whole rendered HTML.
We will send you exact code.

Hope this helps you.
MandyProgza, can you please share you rendered HTML ?
so that we can add functions and validation logics around that.
MandyProgzaAuthor Commented:

The code that I am using is attached in the file named example.txt.  The one that was on the aspx page when the exception was thrown is in the file named rendered-code.txt

I tried using the code below and was able to assign the value if the cell of an ultrawebgrid was selected. What I need is to have the visibility set to false or true depending on value of cell in grid as specified on example.txt

The document.getElementById("<%=txtOthers.ClientID%>").value = "no";

Please assist!

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

One more thing:

in file: rendered-code.txt

code is like:

document.getElementById("System.Web.UI.HtmlControls.HtmlInputText").style.display = 'none';

Can you please share information that how this is getting added?
and what you want to achieve here ?
MandyProgzaAuthor Commented:

The textbox that I want to hide is not inside the grid. It is only hidden depending on the value of a particular cell in the ultrawebgrid.

I have set the CliedIDMode property of the grid and textbox to static.

How do I get the rendered HTML?

Ray PaseurConnect With a Mentor Commented:
How do I get the rendered HTML?
Use the browser's "view source" function, select, copy, paste.
Vadim RappCommented:
Code an event that gets fired when the value of the cell gets changed; in that code, set textbox.visible depending on the value of the cell.

In the regular gridview, the event would be RowUpdated, or RowUpdating, depending on how you want it. Your Ultrawebgrid probably has something similar.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.