Click here to Skip to main content
15,903,724 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: POSTBACK PROBLEM Pin
Perspx22-Sep-08 20:17
Perspx22-Sep-08 20:17 
QuestionDoubt about List box Control Pin
pradees4u22-Sep-08 19:32
pradees4u22-Sep-08 19:32 
QuestionSession management problem Pin
krishnaveer22-Sep-08 18:45
krishnaveer22-Sep-08 18:45 
GeneralRe: Session management problem Pin
Krazy Programmer22-Sep-08 19:37
Krazy Programmer22-Sep-08 19:37 
GeneralRe: Session management problem Pin
krishnaveer22-Sep-08 19:54
krishnaveer22-Sep-08 19:54 
GeneralRe: Session management problem Pin
Tamer Oz22-Sep-08 20:55
Tamer Oz22-Sep-08 20:55 
QuestionAccessing properties of a control through Javascript Pin
Crazy Genius22-Sep-08 18:04
Crazy Genius22-Sep-08 18:04 
AnswerRe: Accessing properties of a control through Javascript Pin
Steve Echols22-Sep-08 18:27
Steve Echols22-Sep-08 18:27 
One way would be to use a hidden field, which get's posted back to the parent.

Set the value of the hidden field to whatever you want, maybe a comma delimited list of selections from the list box.

In aspx:

<asp:hiddenfield id="thehiddenfield" runat="server" />

<script type="text/javascript">

function setHiddenField(val)
{
var el = document.getElementById(_hiddenFieldId);
el.value = val;
}

</script>


Somewhere in your Page_Load handler:

Page.ClientScript.RegisterClientScriptBlock(typeof(theform), "hiddenvar", "var _hiddenFieldId='" & thehiddenfield.ClientID & "';", true);

Note: You could just use view page source to find out the id of the hidden input field to set, if you don't want to go through all the hoops, but if it's in a control or master page and get's moved, you'll have to update the id.

Now, when your page posts back, the hidden field will be set to whatever you set it to and you can access it in the code behind using something like:

string vals = thehiddenfield.Value.ToString();

Hope that makes sense, it's kind of convoluted (but then again, so is asp.net Smile | :) ).
GeneralRe: Accessing properties of a control through Javascript Pin
Crazy Genius23-Sep-08 18:17
Crazy Genius23-Sep-08 18:17 
GeneralRe: Accessing properties of a control through Javascript Pin
Steve Echols23-Sep-08 18:43
Steve Echols23-Sep-08 18:43 
GeneralRe: Accessing properties of a control through Javascript Pin
Crazy Genius23-Sep-08 19:28
Crazy Genius23-Sep-08 19:28 
GeneralRe: Accessing properties of a control through Javascript Pin
Steve Echols23-Sep-08 19:34
Steve Echols23-Sep-08 19:34 
GeneralRe: Accessing properties of a control through Javascript Pin
Crazy Genius23-Sep-08 19:41
Crazy Genius23-Sep-08 19:41 
GeneralRe: Accessing properties of a control through Javascript Pin
Crazy Genius25-Sep-08 17:28
Crazy Genius25-Sep-08 17:28 
Questionreset when tab click Pin
jhyn22-Sep-08 16:34
jhyn22-Sep-08 16:34 
QuestionEnable/Disable Button through javascript [modified] Pin
xfitr222-Sep-08 16:24
xfitr222-Sep-08 16:24 
AnswerRe: Enable/Disable Button through javascript Pin
Tamer Oz22-Sep-08 21:31
Tamer Oz22-Sep-08 21:31 
QuestionAjax and SQL Pin
Jacob Dixon22-Sep-08 13:51
Jacob Dixon22-Sep-08 13:51 
QuestionReportViewer Pin
kenexcelon22-Sep-08 11:53
kenexcelon22-Sep-08 11:53 
QuestionAdding data using a user control. Pin
udaykatakam22-Sep-08 8:28
udaykatakam22-Sep-08 8:28 
AnswerRe: Adding data using a user control. Pin
ToddHileHoffer22-Sep-08 10:38
ToddHileHoffer22-Sep-08 10:38 
GeneralRe: Adding data using a user control. Pin
udaykatakam22-Sep-08 13:28
udaykatakam22-Sep-08 13:28 
GeneralRe: Adding data using a user control. Pin
ToddHileHoffer23-Sep-08 2:21
ToddHileHoffer23-Sep-08 2:21 
GeneralRe: Adding data using a user control. Pin
udaykatakam23-Sep-08 19:28
udaykatakam23-Sep-08 19:28 
GeneralRe: Adding data using a user control. Pin
ToddHileHoffer24-Sep-08 2:05
ToddHileHoffer24-Sep-08 2:05 

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.