Showing posts with label content. Show all posts
Showing posts with label content. Show all posts

Saturday, March 31, 2012

Story Ads

Hi,

We have all seen them. Those square ads inside of textual content wherethe text wraps around the ad. The ad is about halfway down the text andit floats either left, or right.

What would be the best way to do those kinds of ads? I imagine youcould take the text and count to...let's say 300 characters from theleft, insert the ad and then pick up the text starting at position 301.This seems crude and might cause problems. If the text includes htmltags, position 300 may be an opening, or closing caret, which wouldmess with the formatting.

Any ideas on how to do this in a more elegant way?

Thanks!

<img align=right src="http://pics.10026.com/?src=somepage.aspx">

This will wrap text around it, aligning it on the right and let you use "somepage.aspx" to generate the ad

Monday, March 26, 2012

Strange CSS problem

I have a DotNet Table (asp:Table)
in that table, I have multiple rows and cells, of course -
One table cell is designated for 'content' -
I originally had just assigned a style inline with the tag:
<asp:TableCell Width="615" align="Left" valign="Top" Style="BORDER-TOP:
#000000 2px solid;" ID="ContentCell">
This worked fine.

However, the owners of the page decided it needed a change - on the click of
a button, the styles, etc for the page needed to be changed for the
implementation they needed (long story - won't bore you with that)

so - the page already had a stylesheet linked to it - so I created a new
class:
..TopBorder2 {BORDER-TOP: #000000 12px solid;}

then, I changed the cell to :
<asp:TableCell Width="615" align="Left" valign="Top" CssClass="TopBorder2"
ID="ContentCell"
At this point, I also created a TopBorder0 class, to blank out that border
on the button click...great idea - right?
The CssClass attribute wasn't available at all...I've tried moving it to
the Page_Prerender, the Page_load and included it in the tag itself - it
never rendered to the page

any ideas?when in doubt resort to the tried and true method...
..Attributes.Add("class","TopBorder1")

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"Elmo Watson" wrote:

> I have a DotNet Table (asp:Table)
> in that table, I have multiple rows and cells, of course -
> One table cell is designated for 'content' -
> I originally had just assigned a style inline with the tag:
> <asp:TableCell Width="615" align="Left" valign="Top" Style="BORDER-TOP:
> #000000 2px solid;" ID="ContentCell">
> This worked fine.
> However, the owners of the page decided it needed a change - on the click of
> a button, the styles, etc for the page needed to be changed for the
> implementation they needed (long story - won't bore you with that)
> so - the page already had a stylesheet linked to it - so I created a new
> class:
> ..TopBorder2 {BORDER-TOP: #000000 12px solid;}
> then, I changed the cell to :
> <asp:TableCell Width="615" align="Left" valign="Top" CssClass="TopBorder2"
> ID="ContentCell">
> At this point, I also created a TopBorder0 class, to blank out that border
> on the button click...great idea - right?
> The CssClass attribute wasn't available at all...I've tried moving it to
> the Page_Prerender, the Page_load and included it in the tag itself - it
> never rendered to the page
> any ideas?
>
if the button click only need to change styles (if you are currently posting
back only to change the style) javascript would be the best solution...

<script>
function ChangeStyle()
{
document.getElementById("ContentCell").className = "TopBorder0";
}
</script
calling this client side function on button click will change the style

"Elmo Watson" wrote:

> I have a DotNet Table (asp:Table)
> in that table, I have multiple rows and cells, of course -
> One table cell is designated for 'content' -
> I originally had just assigned a style inline with the tag:
> <asp:TableCell Width="615" align="Left" valign="Top" Style="BORDER-TOP:
> #000000 2px solid;" ID="ContentCell">
> This worked fine.
> However, the owners of the page decided it needed a change - on the click of
> a button, the styles, etc for the page needed to be changed for the
> implementation they needed (long story - won't bore you with that)
> so - the page already had a stylesheet linked to it - so I created a new
> class:
> ..TopBorder2 {BORDER-TOP: #000000 12px solid;}
> then, I changed the cell to :
> <asp:TableCell Width="615" align="Left" valign="Top" CssClass="TopBorder2"
> ID="ContentCell">
> At this point, I also created a TopBorder0 class, to blank out that border
> on the button click...great idea - right?
> The CssClass attribute wasn't available at all...I've tried moving it to
> the Page_Prerender, the Page_load and included it in the tag itself - it
> never rendered to the page
> any ideas?
I just tried:
ContentCell.Attributes.Add("class","TopBorder2")
in Page_load, but it didn't render to the page...

what am I missing?

"Curt_C [MVP]" <software_at_darkfalz.com> wrote in message
news:1E9E8E4D-255D-4E37-BF6B-C67D2C9BA13D@.microsoft.com...
> when in doubt resort to the tried and true method...
> .Attributes.Add("class","TopBorder1")
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
>
> "Elmo Watson" wrote:
>> I have a DotNet Table (asp:Table)
>> in that table, I have multiple rows and cells, of course -
>> One table cell is designated for 'content' -
>> I originally had just assigned a style inline with the tag:
>> <asp:TableCell Width="615" align="Left" valign="Top" Style="BORDER-TOP:
>> #000000 2px solid;" ID="ContentCell">
>> This worked fine.
>>
>> However, the owners of the page decided it needed a change - on the click
>> of
>> a button, the styles, etc for the page needed to be changed for the
>> implementation they needed (long story - won't bore you with that)
>>
>> so - the page already had a stylesheet linked to it - so I created a new
>> class:
>> ..TopBorder2 {BORDER-TOP: #000000 12px solid;}
>>
>> then, I changed the cell to :
>> <asp:TableCell Width="615" align="Left" valign="Top"
>> CssClass="TopBorder2"
>> ID="ContentCell">
>>
>> At this point, I also created a TopBorder0 class, to blank out that
>> border
>> on the button click...great idea - right?
>> The CssClass attribute wasn't available at all...I've tried moving it to
>> the Page_Prerender, the Page_load and included it in the tag itself - it
>> never rendered to the page
>>
>> any ideas?
>>
>>
>
runat=server

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com

"David Wier" wrote:

> I just tried:
> ContentCell.Attributes.Add("class","TopBorder2")
> in Page_load, but it didn't render to the page...
> what am I missing?
>
> "Curt_C [MVP]" <software_at_darkfalz.com> wrote in message
> news:1E9E8E4D-255D-4E37-BF6B-C67D2C9BA13D@.microsoft.com...
> > when in doubt resort to the tried and true method...
> > .Attributes.Add("class","TopBorder1")
> > --
> > Curt Christianson
> > site: http://www.darkfalz.com
> > blog: http://blog.darkfalz.com
> > "Elmo Watson" wrote:
> >> I have a DotNet Table (asp:Table)
> >> in that table, I have multiple rows and cells, of course -
> >> One table cell is designated for 'content' -
> >> I originally had just assigned a style inline with the tag:
> >> <asp:TableCell Width="615" align="Left" valign="Top" Style="BORDER-TOP:
> >> #000000 2px solid;" ID="ContentCell">
> >> This worked fine.
> >>
> >> However, the owners of the page decided it needed a change - on the click
> >> of
> >> a button, the styles, etc for the page needed to be changed for the
> >> implementation they needed (long story - won't bore you with that)
> >>
> >> so - the page already had a stylesheet linked to it - so I created a new
> >> class:
> >> ..TopBorder2 {BORDER-TOP: #000000 12px solid;}
> >>
> >> then, I changed the cell to :
> >> <asp:TableCell Width="615" align="Left" valign="Top"
> >> CssClass="TopBorder2"
> >> ID="ContentCell">
> >>
> >> At this point, I also created a TopBorder0 class, to blank out that
> >> border
> >> on the button click...great idea - right?
> >> The CssClass attribute wasn't available at all...I've tried moving it to
> >> the Page_Prerender, the Page_load and included it in the tag itself - it
> >> never rendered to the page
> >>
> >> any ideas?
> >>
> >>
> >>
>

Thursday, March 22, 2012

Strange HttpContext issue

Hello all
I've got a very weird situation I need help with. I'm building a
solution where I have custom components in a web content management
system using a web store library (API in DLLs). The CMS is using Forms
authentication to verify users when they log in. I log the user in
using the following code:
private bool AttemptLogon( string username, string password )
{
_errorMessage = "";
Customer customer = new Customer();
try
{
if (Customer.Login(username,password))
{
FormsAuthentication.SetAuthCookie(username,false,
"/boksala");
string redirecturl = (string)Session["oshopredirecturl"];
if (redirecturl != null && redirecturl != string.Empty)
{
Session.Abandon();
Response.Redirect( redirecturl );
}
else
{
Response.Redirect(HttpUrlBuilder.GetStoreHomePage().ToString());
}
return true;
}
else
{
_errorMessage = RM.GetString("ERROR_LOGIN_FAILED");
return false;
}
}
catch(AccountDisabledException)
{
_errorMessage = RM.GetString("ERROR_ACCOUNT_DISABLED");
}
return false;
}
After this is run, and a valid user is provided, the
HttpContext.Current.User.IsAuthenticated returns true and all is well.
When I then debug the 3rd party web store API DLL, everything turns
strange! The authentication type is all of a sudden Windows
Authentication, and IsAuthenticated returns false! How can this be? Is
there any possibility that there are two different HttpContexts? This
is within the same aspx page, and the context should therefore be the
same. I'm not sure if the 3rd Party API does something to change the
authentication mode all of a sudden, and I've searched for any
explanation in vain. Any ideas?
ThanksOne good place to start is with the API documentation. Have a look to see
how it handles authentication in a server environment.
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
----
"Torfi" <torfig@.gmail.com> wrote in message
news:1149265535.183815.269420@.i40g2000cwc.googlegroups.com...
> Hello all
> I've got a very weird situation I need help with. I'm building a
> solution where I have custom components in a web content management
> system using a web store library (API in DLLs). The CMS is using Forms
> authentication to verify users when they log in. I log the user in
> using the following code:
> private bool AttemptLogon( string username, string password )
> {
> _errorMessage = "";
> Customer customer = new Customer();
> try
> {
> if (Customer.Login(username,password))
> {
> FormsAuthentication.SetAuthCookie(username,false,
> "/boksala");
> string redirecturl = (string)Session["oshopredirecturl"];
> if (redirecturl != null && redirecturl != string.Empty)
> {
> Session.Abandon();
> Response.Redirect( redirecturl );
> }
> else
> {
> Response.Redirect(HttpUrlBuilder.GetStoreHomePage().ToString());
> }
> return true;
> }
> else
> {
> _errorMessage = RM.GetString("ERROR_LOGIN_FAILED");
> return false;
> }
> }
> catch(AccountDisabledException)
> {
> _errorMessage = RM.GetString("ERROR_ACCOUNT_DISABLED");
> }
> return false;
> }
> After this is run, and a valid user is provided, the
> HttpContext.Current.User.IsAuthenticated returns true and all is well.
> When I then debug the 3rd party web store API DLL, everything turns
> strange! The authentication type is all of a sudden Windows
> Authentication, and IsAuthenticated returns false! How can this be? Is
> there any possibility that there are two different HttpContexts? This
> is within the same aspx page, and the context should therefore be the
> same. I'm not sure if the 3rd Party API does something to change the
> authentication mode all of a sudden, and I've searched for any
> explanation in vain. Any ideas?
> Thanks
>

Strange HttpContext issue

Hello all

I've got a very weird situation I need help with. I'm building a
solution where I have custom components in a web content management
system using a web store library (API in DLLs). The CMS is using Forms
authentication to verify users when they log in. I log the user in
using the following code:

private bool AttemptLogon( string username, string password )
{
_errorMessage = "";
Customer customer = new Customer();
try
{
if (Customer.Login(username,password))
{

FormsAuthentication.SetAuthCookie(username,false,
"/boksala");

string redirecturl = (string)Session["oshopredirecturl"];
if (redirecturl != null && redirecturl != string.Empty)
{
Session.Abandon();
Response.Redirect( redirecturl );
}
else
{

Response.Redirect(HttpUrlBuilder.GetStoreHomePage( ).ToString());
}
return true;
}
else
{
_errorMessage = RM.GetString("ERROR_LOGIN_FAILED");
return false;
}
}
catch(AccountDisabledException)
{
_errorMessage = RM.GetString("ERROR_ACCOUNT_DISABLED");
}

return false;
}

After this is run, and a valid user is provided, the
HttpContext.Current.User.IsAuthenticated returns true and all is well.
When I then debug the 3rd party web store API DLL, everything turns
strange! The authentication type is all of a sudden Windows
Authentication, and IsAuthenticated returns false! How can this be? Is
there any possibility that there are two different HttpContexts? This
is within the same aspx page, and the context should therefore be the
same. I'm not sure if the 3rd Party API does something to change the
authentication mode all of a sudden, and I've searched for any
explanation in vain. Any ideas?

ThanksOne good place to start is with the API documentation. Have a look to see
how it handles authentication in a server environment.

--

________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-----------------

"Torfi" <torfig@.gmail.com> wrote in message
news:1149265535.183815.269420@.i40g2000cwc.googlegr oups.com...
> Hello all
> I've got a very weird situation I need help with. I'm building a
> solution where I have custom components in a web content management
> system using a web store library (API in DLLs). The CMS is using Forms
> authentication to verify users when they log in. I log the user in
> using the following code:
> private bool AttemptLogon( string username, string password )
> {
> _errorMessage = "";
> Customer customer = new Customer();
> try
> {
> if (Customer.Login(username,password))
> {
> FormsAuthentication.SetAuthCookie(username,false,
> "/boksala");
> string redirecturl = (string)Session["oshopredirecturl"];
> if (redirecturl != null && redirecturl != string.Empty)
> {
> Session.Abandon();
> Response.Redirect( redirecturl );
> }
> else
> {
> Response.Redirect(HttpUrlBuilder.GetStoreHomePage( ).ToString());
> }
> return true;
> }
> else
> {
> _errorMessage = RM.GetString("ERROR_LOGIN_FAILED");
> return false;
> }
> }
> catch(AccountDisabledException)
> {
> _errorMessage = RM.GetString("ERROR_ACCOUNT_DISABLED");
> }
> return false;
> }
> After this is run, and a valid user is provided, the
> HttpContext.Current.User.IsAuthenticated returns true and all is well.
> When I then debug the 3rd party web store API DLL, everything turns
> strange! The authentication type is all of a sudden Windows
> Authentication, and IsAuthenticated returns false! How can this be? Is
> there any possibility that there are two different HttpContexts? This
> is within the same aspx page, and the context should therefore be the
> same. I'm not sure if the 3rd Party API does something to change the
> authentication mode all of a sudden, and I've searched for any
> explanation in vain. Any ideas?
> Thanks