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

Greetings

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.

Regards
Mandyprog
MandyProgzaAsked:
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.

MrunalCommented:
MandyProgza, can you please share you rendered HTML ?
so that we can add functions and validation logics around that.
0
MandyProgzaAuthor Commented:
Hi

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!

Regards
Mandyprog
example.txt
rendered-code.txt
0
MrunalCommented:
Hi,
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:

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

Steps:

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)

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

new:
$('$input[id$="txtOthers"]').val('no');

and

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

new:
$('$input[id$="txtOthers"]').val('yes');

============================================================

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

Hope this helps you.
0

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!

MrunalCommented:
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 ?
0
MandyProgzaAuthor Commented:
Hi

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?

Regards
0
Ray PaseurCommented:
How do I get the rendered HTML?
Use the browser's "view source" function, select, copy, paste.
0
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.
0
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
JavaScript

From novice to tech pro — start learning today.