Solved

Get values with ASP.NET that was set by Java

Posted on 2006-06-29
3
815 Views
Last Modified: 2008-01-09
Hi all!
   I'm using Infragistics' UltraWebGrid.  With this grid, I'm changing the backcolor of a cell (DarkBlue) when I click it.  If I click on it again, the backcolor is restored to it's original color (White); basically toggling the BgColor with each click.  The kicker is I'm accomplishing this with client-side events with Java to eliminate unnecessary postbacks.
   I've got an OK button on this page, as well.  When I click it, I wan't to be able to determine which cells are blue, and which are white.  The problem is, when I attempt to get the colors, nothing is returned (Color [Empty]).  I asked Infragistics about this and I was told that, because I'm setting the values of the cells with Java, ASP.NET cannot see the colors because they're set on the client and not the server.
  Question:  Is there a way or technique I can use to pass these grid color to ASP.NET for validation?

TO SET THE COLORS, I USE:
function UltraWebGrid1_CellClickHandler(gridName, cellId, button){
      var cell=igtbl_getCellById(cellId);
      
      if(cell.Element.style.backgroundColor=="blue")
      {
              cell.Element.style.backgroundColor="white";
      
      }
      else
      cell.Element.style.backgroundColor="blue";
}


0
Comment
Question by:CArnold
3 Comments
 
LVL 10

Accepted Solution

by:
orbulat earned 500 total points
ID: 17016149
maybe u can try to use hidden variable

function UltraWebGrid1_CellClickHandler(gridName, cellId, button){
     var cell=igtbl_getCellById(cellId);
     
     if(cell.Element.style.backgroundColor=="blue")
     {
             cell.Element.style.backgroundColor="white";
             document.getElementById("hColor").value = "white";
     }
     else
    {
        cell.Element.style.backgroundColor="blue";
        document.getElementById("hColor").value = "blue";
    }
}

<input type=hidden runat=server id=hColor />

but make sure the ID of the hidden control is really "hColor" or not, because if u're using webusercontrol, the id will be "WebUserControl1_hColor"
u can check this by "view source"

then in your code behind, u can get the value from hColor
e.g
string result = hColor.Value;
0
 
LVL 1

Author Comment

by:CArnold
ID: 17171956
Well, this answer did answer my question.  I was hoping for something more ASP.NET-centric, but it doesn't look like there is such a solution.

Thanks for your help, orbulat!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question