|
Hi,
I have a master page & various pages that will use this master page. Each content page will have a CSS & JS file which will be named the same as the content page.
When I try to load the CSS & JS files using the code behind of the content page, my buttons aren't rendered and Im not sure why?
<b>Here is the code for my content page - Properties.aspx:-</b>
<code><%@ Page Language="C#" AutoEventWireup="true" Title="Properties" CodeFile="Properties.aspx.cs" Inherits="Properties" MasterPageFile="~/MasterPage.master"%>
<asp:Content ID="_propertiesContent" ContentPlaceHolderID="_mainContentHolder" runat="Server">
<asp:Label ID="_test" Text="This is the main content panel holder" runat="server" />
<br />
</asp:Content>
<asp:Content ID="_buttonContent" ContentPlaceHolderID="_buttonContentHolder" runat="server" >
<asp:Button ID="Button1" runat="server" Text="Save" CssClass="button" />
<asp:Button ID="Button2" runat="server" Text="Undo" CssClass="button" />
<br />
</asp:Content>
<asp:Content ID="_validationContent" ContentPlaceHolderID="_validationContentHolder" runat="server">
<asp:ValidationSummary ID="validationSummary" ValidationGroup="ValidationGroup" runat="Server" />
</asp:Content></code>
<b>Here is the code behind for Properties.aspx.cs:-</b>
<code>using ASP;
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Properties : Page
{
private string _pageName;
protected void Page_Load(object sender, EventArgs e)
{
_pageName = Page.GetType().Name.Substring(0, Page.GetType().Name.IndexOf("_"));
if (!IsPostBack)
{
LoadStyleSheets();
LoadJavascriptFile();
}
}
private void LoadStyleSheets()
{
HtmlLink link = new HtmlLink();
link.Href = string.Format("~/{0}.css", _pageName);
link.Attributes["text"] = "text/css";
link.Attributes["rel"] = "stylesheet";
this.Header.Controls.Add(link);
}
private void LoadJavascriptFile()
{
HtmlGenericControl javaScriptLink = new HtmlGenericControl();
javaScriptLink.TagName = "script";
javaScriptLink.Attributes.Add("type", "javascript");
javaScriptLink.Attributes.Add("src", string.Format("JS/{0}.js", _pageName));
}
}</code>
<b>My Master Page code is:-</b>
<code><%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" Debug="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Master Page</title>
</head>
<body>
<form id="MainForm" runat="server">
<!-- This bit in here needs to be configurable per page, main content section -->
<asp:ContentPlaceHolder ID="_mainContentHolder" runat="server" />
<!-- This bit in here needs to be configurable per page, button section -->
<asp:ContentPlaceHolder ID="_buttonContentHolder" runat="server" />
<!-- This bit is for the validation summary for each page -->
<asp:ContentPlaceHolder id="_validationContentHolder" runat="server" />
</form>
</body>
</html></code>
<b>If I comment out the methods to Load CSS file & Load JS files in my properties page - then my label text & my buttons are rendered, but if I leave these methods in, then only my Label text renders - Any ideas why?</b>
Many thanks
Janet
|
|
|
|
|
Have you verified that the link being generated is correct ? What if you get rid of this code and hard code a link in a single page, does that work ? My first guess is that the css is creating a style which stops the buttons from rendering.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
Yes the link generated is correct. I did as you suggested and it was a style in the css that was stopping the button from being rendered - Thanks, sometimes you cant see the wood for the trees!
Thanks
Janet
|
|
|
|
|
*grin* I know just what you mean, especially when it comes to CSS.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hello Everyone,
Can any one suggest me to get the data from database using datasets.
after that we need to generate the crystal report into PDF format..
Right now i am using vs.net 2005 we need get the data from database located in app_data in 2005 database...
so kindly suggest me how to approach this and give me step by step process...
Many Thanks
Vijay
|
|
|
|
|
hi guys
i am having a small problem as i am new to dot net ,,
i have a query "select * from table abc where filedabc in ? "
i am using oledbconnection
here is my string which i am passing as a parameter to my command object
like
string dept
Dept="'ITS',"
Dept = Dept & "'MECH',"
Dept = Left(Dept, Len(Dept) - 1)
dim par as new oledbparameter("name",Dept)
com.parameters.add(par)
but it doest not give me any result
command is executed withour exception
why ?
thanks in advance
hello
|
|
|
|
|
Which is the method you are using to execute query ?
|
|
|
|
|
Dim dr As OleDbDataReader = com.ExecuteReader()
hello
|
|
|
|
|
ghumman63 wrote: Dept="'ITS',"
Dept = Dept & "'MECH',"
Dept = Left(Dept, Len(Dept) - 1)
Why on earth are you doing all of this ?
In any case, your SQL looks completely wrong to me. The word 'table' is not needed, it's an error. I can't even work out what the tail end of the query is supposed to be doing.
It looks to me like you're making it up as you go, are you also new to SQL ? Either way, if you get an exception, tell us what it is, otherwise you leave us having to guess. My guess is, it's telling you the SQL is wrong, which it is. Try putting the SQL into the query analyser first, if it doesn't run in SQL Server, or access, or whatever, it won't run when C# tries to execute it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
my dear
it is
select * from tableabc where filedabc in ? "
here the space was a mistake ,, not in sql )
there is no exception ,, it simply doest not get any row from the oracle server, though there
are about to 20,000
records
thanks in advance
hello
|
|
|
|
|
I am surprised there is no error message, unless Oracle is different to SQL Server, or the parameter wrapping does some string mashing for you. You're passing something like
'parm1', 'parm2'
to the parameter. The correct SQL would be
select * from tableabc where filedabc in ('parm1', 'parm2')
if you take the string you're passing through and put it into the Oracle client tools, do you get any results ?
I take it your code is a simplified example, because you are in fact building a dynamic list of strings for the parameter ? Perhaps you need to post the actual code ? Or you need to at least look at the actual parameter being generated, in the debugger.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
wild card characters are used to match strings as
select * from table where name LIKE '%brown%';
but doesnt supports matching of dates,number
what will we do if we want approximate matching of dates and numbers??
$h@ma!|@
|
|
|
|
|
You do a select like
select * from table where created > DATEADD(month, -1, @date) and created < DATEADD(month, 1, @date)
this searches for a date within a month on either side of the date provided.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i have a dropdownlist .I press control button and select two values hwo to get this two values ?
|
|
|
|
|
which two values?
best regard
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
the two options which we had selected by pressing the control button of the listbox .
|
|
|
|
|
You can loop through the items and then get the selected one from that.
Apurva Kaushal
|
|
|
|
|
what r u exectly doing here?
U have one dropdownlist, one listbox and one control button.Right?
and u want to get selected two values of listbox on click of control button.
so what about dropdownlist?
please explain clearly
Best Regard
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
sorry for the misunderstanding which i generated .i have only one listbox control which selects more than two values by pressing contorl button. I want to have the selected values.
String drpDownVal = ((ListBox)Repeater1.Items[i].FindControl("item2")).SelectedValue.ToString();
thanks
|
|
|
|
|
for(int i=0;i<=ListBox1.Items.Count-1;i++)
{
if ( ListBox1.Items[i].Selected )
Response.Write(ListBox1.Items[i].Text);
}
|
|
|
|
|
ListBox listbox=(ListBox)Repeater1.Items[i].FindControl("item2");
ArrayList arr=new ArrayList();
for(int i=0;i<listbox.Items.Count-1;i++)
{
if(listbox.Items[i].Selected)
arr.Add(listbox1.Items[i].Text)
}
U will get array of selected items text
Best Regard
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
Hey
i am new to asp.net.
I just made a small user control now i want to see it on a toolbox provided with visual Studio 2005 how can i do it...
Thank You
Vikram
|
|
|
|
|
HI vikram
Usercotnrol can't be added in toolbox
Best Regard
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
Thanks.....
Vikram
I Code...
|
|
|
|
|
I am trying to change values of margins in Registry using C# but for path Software\\microsoft\\internet explorer\\pagesetup i got null reference, in regedit list i have path.
Code which I am using is:
RegistryKey pk = Registry.CurrentUser.OpenSubKey("Software\\microsoft\\internet explorer\\pagesetup", true);<br />
pk.SetValue("margin_top", "0.20000");<br />
Is there permisions case or anything else? How can I solve it? Thanks in help to everyone.
I Love SQL
|
|
|
|