Click here to Skip to main content
15,903,175 members
Home / Discussions / C#
   

C#

 
GeneralRe: Display as string in datetime custom format Pin
Christian Graus14-Nov-06 12:30
protectorChristian Graus14-Nov-06 12:30 
GeneralRe: Display as string in datetime custom format Pin
Mary Parkhouse15-Nov-06 6:16
Mary Parkhouse15-Nov-06 6:16 
AnswerRe: Display as string in datetime custom format Pin
Christian Graus14-Nov-06 12:30
protectorChristian Graus14-Nov-06 12:30 
QuestionPassing variables from C# to JavaScript Pin
DanB198314-Nov-06 10:53
DanB198314-Nov-06 10:53 
AnswerRe: Passing variables from C# to JavaScript Pin
Christian Graus14-Nov-06 12:32
protectorChristian Graus14-Nov-06 12:32 
AnswerRe: Passing variables from C# to JavaScript Pin
Guffa14-Nov-06 12:34
Guffa14-Nov-06 12:34 
GeneralRe: Passing variables from C# to JavaScript Pin
DanB198314-Nov-06 22:03
DanB198314-Nov-06 22:03 
AnswerRe: Passing variables from C# to JavaScript Pin
Justin.Jones16-Nov-06 9:06
Justin.Jones16-Nov-06 9:06 
I'm not entirely sure I understand what you're trying to do, but here's a few tips that might help.

If simply need a value passed to js, you can use a literal. I'm doing this from memory so the syntax might be a little off, but it should look something like this:

In JS:
<br />
<script lang="javascript"><br />
<!--<br />
var x=<asp:Literal ID="MyVar" runat="server" />;<br />
//do something with it<br />
//--><br />
</script><br />

and in your code put something like

MyVar.Text="bob";

If you need to work with the DOM, you can use the ClientID property of your controls, and write them out in much the same way. ClientID is what will actually get written to the page.

btnSubmit.Attributes.Add("onClick", string.Format("encrypt({0})",control.ClientID));
or use a literal as before if it's not an event. Then inside the "encrypt" js function you can use the parameter as a control object (TextBox, or whatever).

You can use the ClientScriptManager to accomplish the same thing in code as mentioned before, but I find it more useful for controlling script that is dynamically added to a page such as script included with a control, not so much for merely formatting the script.
QuestionScreen Saver status Pin
Daithi Brennan14-Nov-06 7:45
Daithi Brennan14-Nov-06 7:45 
AnswerRe: Screen Saver status Pin
Luc Pattyn14-Nov-06 12:55
sitebuilderLuc Pattyn14-Nov-06 12:55 
Questionhow to use Sql Server 2005 Reporting Services ? Pin
hdv21214-Nov-06 7:37
hdv21214-Nov-06 7:37 
AnswerRe: how to use Sql Server 2005 Reporting Services ? Pin
ednrgc14-Nov-06 7:45
ednrgc14-Nov-06 7:45 
GeneralRe: how to use Sql Server 2005 Reporting Services ? Pin
hdv21214-Nov-06 9:44
hdv21214-Nov-06 9:44 
GeneralRe: how to use Sql Server 2005 Reporting Services ? Pin
ednrgc14-Nov-06 9:49
ednrgc14-Nov-06 9:49 
QuestionEmbed an exe into app Pin
chossy14-Nov-06 6:48
chossy14-Nov-06 6:48 
AnswerRe: Embed an exe into app Pin
ednrgc14-Nov-06 7:09
ednrgc14-Nov-06 7:09 
GeneralRe: Embed an exe into app Pin
chossy14-Nov-06 7:35
chossy14-Nov-06 7:35 
GeneralRe: Embed an exe into app Pin
ednrgc14-Nov-06 7:41
ednrgc14-Nov-06 7:41 
GeneralRe: Embed an exe into app Pin
chossy14-Nov-06 7:58
chossy14-Nov-06 7:58 
GeneralRe: Embed an exe into app Pin
ednrgc14-Nov-06 9:15
ednrgc14-Nov-06 9:15 
GeneralRe: Embed an exe into app Pin
ednrgc14-Nov-06 9:16
ednrgc14-Nov-06 9:16 
AnswerRe: Embed an exe into app Pin
Judah Gabriel Himango14-Nov-06 8:55
sponsorJudah Gabriel Himango14-Nov-06 8:55 
QuestionOpen a .csproj or .sln file to EDIT my project? Pin
Civic0614-Nov-06 6:13
Civic0614-Nov-06 6:13 
AnswerRe: Open a .csproj or .sln file to EDIT my project? Pin
Judah Gabriel Himango14-Nov-06 6:21
sponsorJudah Gabriel Himango14-Nov-06 6:21 
AnswerRe: Open a .csproj or .sln file to EDIT my project? Pin
ednrgc14-Nov-06 7:10
ednrgc14-Nov-06 7:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.