Click here to Skip to main content
15,920,801 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Converting images to sql server table Pin
Christian Graus29-Oct-09 15:00
protectorChristian Graus29-Oct-09 15:00 
GeneralRe: Converting images to sql server table Pin
Kannan Ar29-Oct-09 15:50
professionalKannan Ar29-Oct-09 15:50 
GeneralRe: Converting images to sql server table Pin
Christian Graus29-Oct-09 15:51
protectorChristian Graus29-Oct-09 15:51 
QuestionHi, i have big problem with TextBox [modified] Pin
mmda29-Oct-09 14:25
mmda29-Oct-09 14:25 
AnswerRe: Hi, i have big problem with TextBox Pin
Christian Graus29-Oct-09 14:28
protectorChristian Graus29-Oct-09 14:28 
AnswerRe: Hi, i have big problem with TextBox Pin
Christian Graus29-Oct-09 14:59
protectorChristian Graus29-Oct-09 14:59 
AnswerRe: Hi, i have big problem with TextBox Pin
Christian Graus29-Oct-09 15:30
protectorChristian Graus29-Oct-09 15:30 
QuestionHow to access a ListBox within a custom control with Javascript in the aspx page. Pin
Rico MNC29-Oct-09 12:10
professionalRico MNC29-Oct-09 12:10 
Turns out my previous solution was a trip down an evil rabbit hole due to reusing a global variable from my JavaScript in my code behind (doh).

Here is the corrected solution, which is a bit uglier:


First, in the custom control I made a public property for the listbox ClientID within the control I wished to access in my Javascript:

public partial class Controls_Locations : System.Web.UI.UserControl
{
 public ListBox Locations
  {
    get {return lbControlVehicles.ClientID; }    

  }


Then in my page code behind I provided a public property for this listbox ClientID string:

private Controls_Locations userLocations;

  public string UserVehiclesListBox
  {
    get { return userLocations.Locations; }
    
  }



In my Page_Load I initialize userLocations:

protected void Page_Load(object sender, EventArgs e)
  {
   if (Page.IsPostBack == false)
    {
      userLocations = this._Locations1;// _Locations1 is the custom control in my aspx file which contains the listbox I want to access



In my aspx file using Javascript:

<uc1:RastracUserVehicle_Locations ID="RastracUserVehicle_Locations1" runat="server" />

<script type="text/javascript" language="javascript">

var myLocationList;

function getLocationListBox()
{
  myLocationList = $get("<%=UserVehiclesListBox%>");

//myLocationList is now the listbox contained within the custom control


}

</script>


I used a "global" Javascript variable so that I only need to get the list once. I have not yet discovered whether accessing the list will cause a post back to the server everytime.
QuestionWeb Site Hosting Process Pin
Shahdat Hosain29-Oct-09 7:12
Shahdat Hosain29-Oct-09 7:12 
AnswerRe: Web Site Hosting Process Pin
Abhishek Sur29-Oct-09 7:19
professionalAbhishek Sur29-Oct-09 7:19 
GeneralRe: Web Site Hosting Process Pin
Shahdat Hosain29-Oct-09 8:17
Shahdat Hosain29-Oct-09 8:17 
GeneralRe: Web Site Hosting Process Pin
Abhishek Sur29-Oct-09 10:36
professionalAbhishek Sur29-Oct-09 10:36 
GeneralRe: Web Site Hosting Process Pin
Christian Graus29-Oct-09 18:58
protectorChristian Graus29-Oct-09 18:58 
GeneralRe: Web Site Hosting Process Pin
Abhishek Sur29-Oct-09 21:16
professionalAbhishek Sur29-Oct-09 21:16 
Questionhow to fix the header in gridview Pin
vedpra29-Oct-09 4:20
vedpra29-Oct-09 4:20 
AnswerRe: how to fix the header in gridview Pin
Kannan Ar29-Oct-09 5:09
professionalKannan Ar29-Oct-09 5:09 
AnswerRe: how to fix the header in gridview Pin
Abhishek Sur29-Oct-09 7:15
professionalAbhishek Sur29-Oct-09 7:15 
QuestionDynamically opening new excel file via a link in another excel file? Pin
Goalie3529-Oct-09 3:48
Goalie3529-Oct-09 3:48 
AnswerRe: Dynamically opening new excel file via a link in another excel file? Pin
Kannan Ar29-Oct-09 4:58
professionalKannan Ar29-Oct-09 4:58 
GeneralRe: Dynamically opening new excel file via a link in another excel file? Pin
Goalie3529-Oct-09 7:48
Goalie3529-Oct-09 7:48 
GeneralRe: Dynamically opening new excel file via a link in another excel file? Pin
Kannan Ar29-Oct-09 16:46
professionalKannan Ar29-Oct-09 16:46 
QuestionHow to redirect to previous usercontrol when clicked on a "Back" Button Pin
getaccessyr29-Oct-09 3:41
getaccessyr29-Oct-09 3:41 
AnswerRe: How to redirect to previous usercontrol when clicked on a "Back" Button Pin
dan!sh 29-Oct-09 3:58
professional dan!sh 29-Oct-09 3:58 
AnswerRe: How to redirect to previous usercontrol when clicked on a "Back" Button Pin
Abhishek Sur29-Oct-09 7:24
professionalAbhishek Sur29-Oct-09 7:24 
Questiontextbox : textmode = password Pin
Hemant Thaker29-Oct-09 3:29
Hemant Thaker29-Oct-09 3:29 

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.