PC Review


Reply
Thread Tools Rate Thread

How do make the best colorpicker option ... hopefully with AJAX

 
 
Mikael Syska
Guest
Posts: n/a
 
      6th Jan 2008
Hi,

I have a problem ...:
If you look at http://syska.dk/upload/eb-14.jpeg you can see some names
to the right ... Alexandro, syska, resurrected.

I want an option to pick a new color for the name when clicking it.

I have a panel with 216 different colors, put into a <table>

But I can't figure out how to make it ... so that I know witch name was
clicked and still get the colorId ...

Also I want to have the "player list" in a updatePanel as I want to use
AJAX ....

I thought it was simple, but I can't figure out, how to do it ...

best regards
Mikael Syska
 
Reply With Quote
 
 
 
 
ThatsIT.net.au
Guest
Posts: n/a
 
      6th Jan 2008
somthing like this, this will solve the clicnt side of the problem if I
understand it.
to send to the server can be solver by adding the values to a hidden field
and retrived on a future event, or you can send via the
ICallbackEventHandler. I have a sample on how to do this.
http://dev.thatsit.net.au/samples/as...k/default.aspx


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
<!--

function window_onload() {
var tds =
document.getElementById('colorPicker').getElementsByTagName('TD')
for (i = 0;i<tds.length;i++){
tds[i].onclick = tabClick
}
}

function tabClick(){
var name = this.innerText
var bgColor = this.style.backgroundColor
alert(name)
alert(bgColor )
}

// -->
</script>
</head>
<body onload="return window_onload()">
<form id="form1" runat="server">
<div>
<table id="colorPicker">
<tr>
<td style="background-color :red;">c1
</td>
<td style="background-color:blue;">c2
</td>
</tr>
<tr>
<td style="background-color:green;">c3
</td>
<td style="background-color:yellow;">c4
</td>
</tr>
</table>
</div>
</form>
</body>
</html>



"Mikael Syska" <(E-Mail Removed)> wrote in message
news:e75Jq%23$(E-Mail Removed)...
> Hi,
>
> I have a problem ...:
> If you look at http://syska.dk/upload/eb-14.jpeg you can see some names to
> the right ... Alexandro, syska, resurrected.
>
> I want an option to pick a new color for the name when clicking it.
>
> I have a panel with 216 different colors, put into a <table>
>
> But I can't figure out how to make it ... so that I know witch name was
> clicked and still get the colorId ...
>
> Also I want to have the "player list" in a updatePanel as I want to use
> AJAX ....
>
> I thought it was simple, but I can't figure out, how to do it ...
>
> best regards
> Mikael Syska


 
Reply With Quote
 
Mikael Syska
Guest
Posts: n/a
 
      6th Jan 2008
Hi,

You are the man ... that solved the last part ... now I will look into
the link you sent ... which also seem to be the best idea with a web
service or some kind ... so I dont have to do full repost of the page,
if the user just want to change color ....

But what about security here ... ? Since I dont have the SesssionID or
anything at the webservice ?

would you just send it to the service, with some special random text
made at login time ... and also control the ip address .... ?

// ouT

ThatsIT.net.au wrote:
> somthing like this, this will solve the clicnt side of the problem if I
> understand it.
> to send to the server can be solver by adding the values to a hidden
> field and retrived on a future event, or you can send via the
> ICallbackEventHandler. I have a sample on how to do this.
> http://dev.thatsit.net.au/samples/as...k/default.aspx
>
>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head runat="server">
> <title>Untitled Page</title>
> <script language="javascript" type="text/javascript">
> <!--
>
> function window_onload() {
> var tds =
> document.getElementById('colorPicker').getElementsByTagName('TD')
> for (i = 0;i<tds.length;i++){
> tds[i].onclick = tabClick
> }
> }
>
> function tabClick(){
> var name = this.innerText
> var bgColor = this.style.backgroundColor
> alert(name)
> alert(bgColor )
> }
>
> // -->
> </script>
> </head>
> <body onload="return window_onload()">
> <form id="form1" runat="server">
> <div>
> <table id="colorPicker">
> <tr>
> <td style="background-color :red;">c1
> </td>
> <td style="background-color:blue;">c2
> </td>
> </tr>
> <tr>
> <td style="background-color:green;">c3
> </td>
> <td style="background-color:yellow;">c4
> </td>
> </tr>
> </table>
> </div>
> </form>
> </body>
> </html>
>
>
>
> "Mikael Syska" <(E-Mail Removed)> wrote in message
> news:e75Jq%23$(E-Mail Removed)...
>> Hi,
>>
>> I have a problem ...:
>> If you look at http://syska.dk/upload/eb-14.jpeg you can see some
>> names to the right ... Alexandro, syska, resurrected.
>>
>> I want an option to pick a new color for the name when clicking it.
>>
>> I have a panel with 216 different colors, put into a <table>
>>
>> But I can't figure out how to make it ... so that I know witch name
>> was clicked and still get the colorId ...
>>
>> Also I want to have the "player list" in a updatePanel as I want to
>> use AJAX ....
>>
>> I thought it was simple, but I can't figure out, how to do it ...
>>
>> best regards
>> Mikael Syska

>

 
Reply With Quote
 
ThatsIT.net.au
Guest
Posts: n/a
 
      6th Jan 2008

"Mikael Syska" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi,
>
> You are the man ... that solved the last part ... now I will look into the
> link you sent ... which also seem to be the best idea with a web service
> or some kind ... so I dont have to do full repost of the page, if the user
> just want to change color ....
>
> But what about security here ... ? Since I dont have the SesssionID or
> anything at the webservice ?
>
> would you just send it to the service, with some special random text made
> at login time ... and also control the ip address .... ?


Not sure what you mean here.
Can you explain a bit more


>
> // ouT
>
> ThatsIT.net.au wrote:
>> somthing like this, this will solve the clicnt side of the problem if I
>> understand it.
>> to send to the server can be solver by adding the values to a hidden
>> field and retrived on a future event, or you can send via the
>> ICallbackEventHandler. I have a sample on how to do this.
>> http://dev.thatsit.net.au/samples/as...k/default.aspx
>>
>>
>> <html xmlns="http://www.w3.org/1999/xhtml">
>> <head runat="server">
>> <title>Untitled Page</title>
>> <script language="javascript" type="text/javascript">
>> <!--
>>
>> function window_onload() {
>> var tds =
>> document.getElementById('colorPicker').getElementsByTagName('TD')
>> for (i = 0;i<tds.length;i++){
>> tds[i].onclick = tabClick
>> }
>> }
>>
>> function tabClick(){
>> var name = this.innerText
>> var bgColor = this.style.backgroundColor
>> alert(name)
>> alert(bgColor )
>> }
>>
>> // -->
>> </script>
>> </head>
>> <body onload="return window_onload()">
>> <form id="form1" runat="server">
>> <div>
>> <table id="colorPicker">
>> <tr>
>> <td style="background-color :red;">c1
>> </td>
>> <td style="background-color:blue;">c2
>> </td>
>> </tr>
>> <tr>
>> <td style="background-color:green;">c3
>> </td>
>> <td style="background-color:yellow;">c4
>> </td>
>> </tr>
>> </table>
>> </div>
>> </form>
>> </body>
>> </html>
>>
>>
>>
>> "Mikael Syska" <(E-Mail Removed)> wrote in message
>> news:e75Jq%23$(E-Mail Removed)...
>>> Hi,
>>>
>>> I have a problem ...:
>>> If you look at http://syska.dk/upload/eb-14.jpeg you can see some names
>>> to the right ... Alexandro, syska, resurrected.
>>>
>>> I want an option to pick a new color for the name when clicking it.
>>>
>>> I have a panel with 216 different colors, put into a <table>
>>>
>>> But I can't figure out how to make it ... so that I know witch name was
>>> clicked and still get the colorId ...
>>>
>>> Also I want to have the "player list" in a updatePanel as I want to use
>>> AJAX ....
>>>
>>> I thought it was simple, but I can't figure out, how to do it ...
>>>
>>> best regards
>>> Mikael Syska

>>


 
Reply With Quote
 
Mikael Syska
Guest
Posts: n/a
 
      6th Jan 2008
Hi again,

ThatsIT.net.au wrote:
>
> "Mikael Syska" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> Hi,
>>
>> You are the man ... that solved the last part ... now I will look into
>> the link you sent ... which also seem to be the best idea with a web
>> service or some kind ... so I dont have to do full repost of the page,
>> if the user just want to change color ....
>>
>> But what about security here ... ? Since I dont have the SesssionID or
>> anything at the webservice ?
>>
>> would you just send it to the service, with some special random text
>> made at login time ... and also control the ip address .... ?

>
> Not sure what you mean here.
> Can you explain a bit more


Maybe it was a little bit to fast explained.

I did the communication with the server via a webservice ... and it
works, but since I dont have access to the Session object in the
webservice, I can't do any authentication.

So ... will the Session object be available with the link you provided ?

Or are there some other smart way I can do it ?

Since later I will implement users ... I will have to know if there are
authenticated, so they can't change other users data ...

>
>
>>

[snip]

best regards
Mikael Syska
 
Reply With Quote
 
ThatsIT.net.au
Guest
Posts: n/a
 
      6th Jan 2008

"Mikael Syska" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi again,
>
> ThatsIT.net.au wrote:
>>
>> "Mikael Syska" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> Hi,
>>>
>>> You are the man ... that solved the last part ... now I will look into
>>> the link you sent ... which also seem to be the best idea with a web
>>> service or some kind ... so I dont have to do full repost of the page,
>>> if the user just want to change color ....
>>>
>>> But what about security here ... ? Since I dont have the SesssionID or
>>> anything at the webservice ?
>>>
>>> would you just send it to the service, with some special random text
>>> made at login time ... and also control the ip address .... ?

>>
>> Not sure what you mean here.
>> Can you explain a bit more

>
> Maybe it was a little bit to fast explained.
>
> I did the communication with the server via a webservice ... and it works,
> but since I dont have access to the Session object in the webservice, I
> can't do any authentication.
>
> So ... will the Session object be available with the link you provided ?
>


Yes it will


> Or are there some other smart way I can do it ?
>
> Since later I will implement users ... I will have to know if there are
> authenticated, so they can't change other users data ...
>


Yes it will work fine.

You might want to look up asp.net profiles to oraganize your user data.
it uses sql database to keep setting for users authenticated or not


>>
>>
>>>

> [snip]
>
> best regards
> Mikael Syska


 
Reply With Quote
 
Mikael Syska
Guest
Posts: n/a
 
      6th Jan 2008
ThatsIT.net.au wrote:
>
> "Mikael Syska" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi again,
>>
>> ThatsIT.net.au wrote:
>>>
>>> "Mikael Syska" <(E-Mail Removed)> wrote in message
>>> news:%(E-Mail Removed)...
>>>> Hi,
>>>>
>>>> You are the man ... that solved the last part ... now I will look
>>>> into the link you sent ... which also seem to be the best idea with
>>>> a web service or some kind ... so I dont have to do full repost of
>>>> the page, if the user just want to change color ....
>>>>
>>>> But what about security here ... ? Since I dont have the SesssionID
>>>> or anything at the webservice ?
>>>>
>>>> would you just send it to the service, with some special random text
>>>> made at login time ... and also control the ip address .... ?
>>>
>>> Not sure what you mean here.
>>> Can you explain a bit more

>>
>> Maybe it was a little bit to fast explained.
>>
>> I did the communication with the server via a webservice ... and it
>> works, but since I dont have access to the Session object in the
>> webservice, I can't do any authentication.
>>
>> So ... will the Session object be available with the link you provided ?
>>

>
> Yes it will
>
>
>> Or are there some other smart way I can do it ?
>>
>> Since later I will implement users ... I will have to know if there
>> are authenticated, so they can't change other users data ...
>>

>
> Yes it will work fine.
>
> You might want to look up asp.net profiles to oraganize your user data.
> it uses sql database to keep setting for users authenticated or not
>
>
>>>
>>>
>>>>

>> [snip]
>>
>> best regards
>> Mikael Syska

>


Nice ...

As I can see it ... it aint possible to have more than one Async
callback per page or am I missing something here ?

Since the implementation of the interface also specify that is going to
happen as return value and input param ...

btw ... thanks very much for the help, it has solved my problem.

// ouT
 
Reply With Quote
 
ThatsIT.net.au
Guest
Posts: n/a
 
      7th Jan 2008

"Mikael Syska" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> ThatsIT.net.au wrote:
>>
>> "Mikael Syska" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hi again,
>>>
>>> ThatsIT.net.au wrote:
>>>>
>>>> "Mikael Syska" <(E-Mail Removed)> wrote in message
>>>> news:%(E-Mail Removed)...
>>>>> Hi,
>>>>>
>>>>> You are the man ... that solved the last part ... now I will look into
>>>>> the link you sent ... which also seem to be the best idea with a web
>>>>> service or some kind ... so I dont have to do full repost of the page,
>>>>> if the user just want to change color ....
>>>>>
>>>>> But what about security here ... ? Since I dont have the SesssionID or
>>>>> anything at the webservice ?
>>>>>
>>>>> would you just send it to the service, with some special random text
>>>>> made at login time ... and also control the ip address .... ?
>>>>
>>>> Not sure what you mean here.
>>>> Can you explain a bit more
>>>
>>> Maybe it was a little bit to fast explained.
>>>
>>> I did the communication with the server via a webservice ... and it
>>> works, but since I dont have access to the Session object in the
>>> webservice, I can't do any authentication.
>>>
>>> So ... will the Session object be available with the link you provided ?
>>>

>>
>> Yes it will
>>
>>
>>> Or are there some other smart way I can do it ?
>>>
>>> Since later I will implement users ... I will have to know if there are
>>> authenticated, so they can't change other users data ...
>>>

>>
>> Yes it will work fine.
>>
>> You might want to look up asp.net profiles to oraganize your user data.
>> it uses sql database to keep setting for users authenticated or not
>>
>>
>>>>
>>>>
>>>>>
>>> [snip]
>>>
>>> best regards
>>> Mikael Syska

>>

>
> Nice ...
>
> As I can see it ... it aint possible to have more than one Async callback
> per page or am I missing something here ?
>
> Since the implementation of the interface also specify that is going to
> happen as return value and input param ...
>
> btw ... thanks very much for the help, it has solved my problem.
>




You can have as many as you want.

what I do is send a string with the "|" symbol as a separator

so I may have a string like this

"job1|value1|value2"

and from another event I may have

"job2|value1|value2|value3"

on the client side is split the string into array at the "|" symbol

the first value in the array "job1" or "job2" tells me what job needs doing

when I send back the result send it back the same way

"job1|result1|result2"

then I split it into a array on the client side using the first value to
identify the job again.


> // ouT


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Make it AJAX enabled John Microsoft ASP .NET 1 24th Jan 2008 01:30 AM
AJAX app will not make call on Safari and FireFox, works fine on Internet Explorer, any ideas? JDeats Microsoft ASP .NET 2 11th Sep 2007 11:20 PM
ASP.NET AJAX Enabled Website Web.config error (newbie to AJAX) Tony K Microsoft ASP .NET 2 4th May 2007 05:23 AM
Deploying ASP.NET AJAX-Enabled Web site to host without AJAX insta =?Utf-8?B?QnJpYW4gRWR3YXJkcw==?= Microsoft ASP .NET 2 21st Feb 2007 10:22 PM
free Progressbar and Colorpicker Milosz - [playseven.com] Microsoft Dot NET Compact Framework 0 9th Feb 2004 09:16 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:42 AM.