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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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!

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

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 PaseurCommented:
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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.