Thursday, March 29, 2012
Set Column Headertext
I have a Datagrid with a templatecolumn, where I add at design time. I also checked the "create columns automatically"
I would like to change the headertext of columns created automatically, but i don't know in which event I can do that
Can you help me
P.S. I tryied to set the headertext in the "PreRender" event of the DataGrid, but in this point the grid has still only the templatecolumn, and the others columns aren't created yet
Thank you
Alessandro RossHi, Alessandro Rossi,
If you extend the DataGrid class (inherit from it) the best place is the
OnDataBinding protected method. You should first call base.OnDataBinding(e);
of course.
If you are simply using the DataGrid class - set the headertexts after you
call DataBind() because the columns are in fact created with this call.
Hope this helps
Martin
"Alessandro Rossi" <alessandro.rossi@.areait.net> wrote in message
news:528CD483-7F36-4D2A-8760-24CD36F0BE8A@.microsoft.com...
> Hi,
> I have a Datagrid with a templatecolumn, where I add at design time. I
also checked the "create columns automatically".
> I would like to change the headertext of columns created automatically,
but i don't know in which event I can do that.
> Can you help me?
> P.S. I tryied to set the headertext in the "PreRender" event of the
DataGrid, but in this point the grid has still only the templatecolumn, and
the others columns aren't created yet.
> Thank you.
> Alessandro Rossi
Thursday, March 22, 2012
Set focus to textbox in gridview
It's a template field. I think I have most of the code figured out (I'll post it when I'm back at my desk), but can't get it to fire the first time a user clicks 'Edit' (but it does fire every time after). Also, how do you set it so the entire value in the field is selected ? Thanks.
Set hidden values and then submit automatically
following payment page:
<script type="text/javascript">
window.onload = function (evt) { document.forms[0].submit(); }
</script>
</head>
<body>
<form name="payform" method="post"
action="https://mmm.com/payment/start.pml">
<input type="hidden" id="amount" name="amount" value=""
runat="server" />
<input type="hidden" name="merchant" value="752" />
</form>
The amount value should be set in the hidden input and then the form
should be submitted autmatically to the payment company. I have
problems capturing and setting the amount value.
I've tried with:
Sub Page_load()
amount.Value = 1212
End Sub
But I receive an error message from the payment company telling me that
amount is missing.
Can someone help me think clear?
Regards,
SDid you check if the value is getting set in the hidden variable before
calling forms[0].submit function?
Regards,
Augustin
http://augustinprasanna.blogspot.com
"staeri@.gmail.com" wrote:
Quote:
Originally Posted by
Quote:
Originally Posted by
From my page shopping cart page I want to send the amount value to the
following payment page:
>
<script type="text/javascript">
window.onload = function (evt) { document.forms[0].submit(); }
</script>
>
</head>
>
<body>
<form name="payform" method="post"
action="https://mmm.com/payment/start.pml">
<input type="hidden" id="amount" name="amount" value=""
runat="server" />
<input type="hidden" name="merchant" value="752" />
</form>
>
The amount value should be set in the hidden input and then the form
should be submitted autmatically to the payment company. I have
problems capturing and setting the amount value.
>
I've tried with:
>
Sub Page_load()
amount.Value = 1212
End Sub
>
But I receive an error message from the payment company telling me that
amount is missing.
>
Can someone help me think clear?
>
Regards,
>
S
>
>
"staeri@.gmail.com" wrote:
Quote:
Originally Posted by
Quote:
Originally Posted by
From my page shopping cart page I want to send the amount value to the
following payment page:
>
<script type="text/javascript">
window.onload = function (evt) { document.forms[0].submit(); }
</script>
>
</head>
>
<body>
<form name="payform" method="post"
action="https://mmm.com/payment/start.pml">
<input type="hidden" id="amount" name="amount" value=""
runat="server" />
<input type="hidden" name="merchant" value="752" />
</form>
>
The amount value should be set in the hidden input and then the form
should be submitted autmatically to the payment company. I have
problems capturing and setting the amount value.
>
I've tried with:
>
Sub Page_load()
amount.Value = 1212
End Sub
>
But I receive an error message from the payment company telling me that
amount is missing.
>
Can someone help me think clear?
If you want to set it using page_load, could you not edit your HTML source
and use:
<input type="hidden" id="amount" name="amount" value="<%=intAmount%>"
runat="server" />
and declare and set intAmount somewhere else?
Tuesday, March 13, 2012
Set Print Margin of Web Page
Thanks a lot!As far as I know, you can't do thisdirectly.
In the past I worked on a project where we wanted a report to automatically print "landscape". We had to install a DLL on the client to get this to work, since the printing attributes are set in the client-machine's registry.
From then to now, I don'tthink there has been any script or CSS properties exposed to allow this to be done.
HTH...
Chris
P.S. - one to to try would be to render your data in HTML tables, centered with fixed width's (the smaller the width, the larger the "margin"). Not sure how elegant of a solution that is, but it should work.
Does anyone know if some javascript might do the above? Still looking for a solution. Thanks!
Don't let the title fool you, ...here is a small excerpt from the article (below):
Users can easily change page margins, header and footer settings, and the default Internet Explorer printer through the Internet Explorer user interface. However, there are no methods under Internet Explorer or the WebBrowser control to change these settings programmatically.
HOWTO: Change Print Settings for Internet Explorer and WebBrowser Control Programmatically
Basically, changing printing options DOES involve changing registry settings on the client machine.
Here is one possible solution (it requires a third-party component though, like I described in my previous post):
HTML Printing
HTH...
Chris
Chris,
Thank you for the additional info. I will check it out.
I have been searching for something similar and, like you have not had too much luck. I did find a third party product that lets you have limited control of print setting for free, and more control if you pay...
link:
http://www.meadroid.com/scriptx/indexa.htm
What other options does a developer have for internet base printing? Has anyone had experiences with dynamic acrobat compilers? How about creating MS Snapshot reports dynamically from an asp page?
I can't believe there is nothing else out there.
The Mead control is the one I used in the past...like you said, limited control for free, more for the paid version.
Honestly though, I haven't found anything else that does the job any better (for true browser based printing). Seems if you truly want to control the print job, you need to use some custom control to generate the doc (like PDF of Crystal reports or something).
Chris
regarding using acrobat or crystal to generate a doc ...
do you mean generate a doc on the client-side or the server-side?
You would really most likely want to generate your reports server-side, where you have a better idea of system configuration/power (as well as control over more of the process). You can't count on a user having a fast machine ;-)
HTH...
Chris
Set Radiobuttonlist Value via Javascript
I have two radiobuttonlist controls on a page. When a user checks 'No' for
rblDeleted, I want to automatically set rblSendCard to 'No' and disable it.
The javascript function I wrote to do this 'appears' to work on the screen,
however, when the page is posted back and I check the value of rblSendCard,
it is an empty string when I expect it to be 'N'.
Of, course I can work around the problem by assuming 'N' when it is an empty
string, but would prefer to have the correct value posted back.
Can anyone tell me how to get it to work the way I expect or explain why it
can't.
Code is below.
TIA
<asp:radiobuttonlist id="rblSendCard" tabIndex="13" runat="server"
RepeatDirection="Horizontal" CellPadding="0"
CellSpacing="0" EnableViewState="False">
<asp:ListItem Value="Y">Yes</asp:ListItem>
<asp:ListItem Value="N">No</asp:ListItem>
</asp:radiobuttonlist>
<asp:radiobuttonlist id="rblDeleted" tabIndex="14" runat="server"
RepeatDirection="Horizontal" EnableViewState="False"
CellPadding="0" CellSpacing="0">
<asp:ListItem Value="Y">Yes</asp:ListItem>
<asp:ListItem Value="N" Selected="True">No</asp:ListItem>
</asp:radiobuttonlist
<script language="JavaScript"> function SetDeleted() {
if(document.getElementById('U_Members1_rblDeleted_ 0').checked){
document.getElementById('U_Members1_rblSendCard_1' ).checked=true;
document.getElementById('U_Members1_rblSendCard'). disabled='disabled';}
else{
document.getElementById('U_Members1_rblSendCard'). disabled='';}}</script
--
Alphonse Giambrone
Email: a-giam at customdatasolutions dot usWhen an html element is disabled, it is not posted in the Request.Forms
Collection.
bill
"Alphonse Giambrone" <NOSPAMa-giam@.example.invalid> wrote in message
news:uZGOHdHMFHA.1948@.TK2MSFTNGP14.phx.gbl...
> Hi all,
> I have two radiobuttonlist controls on a page. When a user checks 'No' for
> rblDeleted, I want to automatically set rblSendCard to 'No' and disable
it.
> The javascript function I wrote to do this 'appears' to work on the
screen,
> however, when the page is posted back and I check the value of
rblSendCard,
> it is an empty string when I expect it to be 'N'.
> Of, course I can work around the problem by assuming 'N' when it is an
empty
> string, but would prefer to have the correct value posted back.
> Can anyone tell me how to get it to work the way I expect or explain why
it
> can't.
> Code is below.
> TIA
> <asp:radiobuttonlist id="rblSendCard" tabIndex="13" runat="server"
> RepeatDirection="Horizontal" CellPadding="0"
> CellSpacing="0" EnableViewState="False">
> <asp:ListItem Value="Y">Yes</asp:ListItem>
> <asp:ListItem Value="N">No</asp:ListItem>
> </asp:radiobuttonlist>
> <asp:radiobuttonlist id="rblDeleted" tabIndex="14" runat="server"
> RepeatDirection="Horizontal" EnableViewState="False"
> CellPadding="0" CellSpacing="0">
> <asp:ListItem Value="Y">Yes</asp:ListItem>
> <asp:ListItem Value="N" Selected="True">No</asp:ListItem>
> </asp:radiobuttonlist>
> <script language="JavaScript"> function SetDeleted() {
> if(document.getElementById('U_Members1_rblDeleted_ 0').checked){
> document.getElementById('U_Members1_rblSendCard_1' ).checked=true;
> document.getElementById('U_Members1_rblSendCard'). disabled='disabled';}
> else{
> document.getElementById('U_Members1_rblSendCard'). disabled='';}}</script>
> --
> Alphonse Giambrone
> Email: a-giam at customdatasolutions dot us
Thanks for the quick reply, Bill.
That certainly explains it.
--
Alphonse Giambrone
Email: a-giam at customdatasolutions dot us
"William F. Robertson, Jr." <theman@.nameht.org> wrote in message
news:eONsxwHMFHA.2736@.TK2MSFTNGP09.phx.gbl...
> When an html element is disabled, it is not posted in the Request.Forms
> Collection.
> bill
>
> "Alphonse Giambrone" <NOSPAMa-giam@.example.invalid> wrote in message
> news:uZGOHdHMFHA.1948@.TK2MSFTNGP14.phx.gbl...
>> Hi all,
>>
>> I have two radiobuttonlist controls on a page. When a user checks 'No'
>> for
>> rblDeleted, I want to automatically set rblSendCard to 'No' and disable
> it.
>> The javascript function I wrote to do this 'appears' to work on the
> screen,
>> however, when the page is posted back and I check the value of
> rblSendCard,
>> it is an empty string when I expect it to be 'N'.
>> Of, course I can work around the problem by assuming 'N' when it is an
> empty
>> string, but would prefer to have the correct value posted back.
>>
>> Can anyone tell me how to get it to work the way I expect or explain why
> it
>> can't.
>> Code is below.
>> TIA
>>
>> <asp:radiobuttonlist id="rblSendCard" tabIndex="13" runat="server"
>> RepeatDirection="Horizontal" CellPadding="0"
>> CellSpacing="0" EnableViewState="False">
>> <asp:ListItem Value="Y">Yes</asp:ListItem>
>> <asp:ListItem Value="N">No</asp:ListItem>
>> </asp:radiobuttonlist>
>> <asp:radiobuttonlist id="rblDeleted" tabIndex="14" runat="server"
>> RepeatDirection="Horizontal" EnableViewState="False"
>> CellPadding="0" CellSpacing="0">
>> <asp:ListItem Value="Y">Yes</asp:ListItem>
>> <asp:ListItem Value="N" Selected="True">No</asp:ListItem>
>> </asp:radiobuttonlist>
>>
>> <script language="JavaScript"> function SetDeleted() {
>> if(document.getElementById('U_Members1_rblDeleted_ 0').checked){
>> document.getElementById('U_Members1_rblSendCard_1' ).checked=true;
>> document.getElementById('U_Members1_rblSendCard'). disabled='disabled';}
>> else{
>> document.getElementById('U_Members1_rblSendCard'). disabled='';}}</script>
>>
>> --
>>
>> Alphonse Giambrone
>> Email: a-giam at customdatasolutions dot us
>>
>>
>>
Set Radiobuttonlist Value via Javascript
I have two radiobuttonlist controls on a page. When a user checks 'No' for
rblDeleted, I want to automatically set rblSendCard to 'No' and disable it.
The javascript function I wrote to do this 'appears' to work on the screen,
however, when the page is posted back and I check the value of rblSendCard,
it is an empty string when I expect it to be 'N'.
Of, course I can work around the problem by assuming 'N' when it is an empty
string, but would prefer to have the correct value posted back.
Can anyone tell me how to get it to work the way I expect or explain why it
can't.
Code is below.
TIA
<asp:radiobuttonlist id="rblSendCard" tabIndex="13" runat="server"
RepeatDirection="Horizontal" CellPadding="0"
CellSpacing="0" EnableViewState="False">
<asp:ListItem Value="Y">Yes</asp:ListItem>
<asp:ListItem Value="N">No</asp:ListItem>
</asp:radiobuttonlist>
<asp:radiobuttonlist id="rblDeleted" tabIndex="14" runat="server"
RepeatDirection="Horizontal" EnableViewState="False"
CellPadding="0" CellSpacing="0">
<asp:ListItem Value="Y">Yes</asp:ListItem>
<asp:ListItem Value="N" Selected="True">No</asp:ListItem>
</asp:radiobuttonlist>
<script language="JavaScript"> function SetDeleted() {
if(document. getElementById('U_Members1_rblDeleted_0'
).checked){
document. getElementById('U_Members1_rblSendCard_1
').checked=true;
document. getElementById('U_Members1_rblSendCard')
.disabled='disabled';}
else{
document. getElementById('U_Members1_rblSendCard')
.disabled='';}}</script>
Alphonse Giambrone
Email: a-giam at customdatasolutions dot usWhen an html element is disabled, it is not posted in the Request.Forms
Collection.
bill
"Alphonse Giambrone" <NOSPAMa-giam@.example.invalid> wrote in message
news:uZGOHdHMFHA.1948@.TK2MSFTNGP14.phx.gbl...
> Hi all,
> I have two radiobuttonlist controls on a page. When a user checks 'No' for
> rblDeleted, I want to automatically set rblSendCard to 'No' and disable
it.
> The javascript function I wrote to do this 'appears' to work on the
screen,
> however, when the page is posted back and I check the value of
rblSendCard,
> it is an empty string when I expect it to be 'N'.
> Of, course I can work around the problem by assuming 'N' when it is an
empty
> string, but would prefer to have the correct value posted back.
> Can anyone tell me how to get it to work the way I expect or explain why
it
> can't.
> Code is below.
> TIA
> <asp:radiobuttonlist id="rblSendCard" tabIndex="13" runat="server"
> RepeatDirection="Horizontal" CellPadding="0"
> CellSpacing="0" EnableViewState="False">
> <asp:ListItem Value="Y">Yes</asp:ListItem>
> <asp:ListItem Value="N">No</asp:ListItem>
> </asp:radiobuttonlist>
> <asp:radiobuttonlist id="rblDeleted" tabIndex="14" runat="server"
> RepeatDirection="Horizontal" EnableViewState="False"
> CellPadding="0" CellSpacing="0">
> <asp:ListItem Value="Y">Yes</asp:ListItem>
> <asp:ListItem Value="N" Selected="True">No</asp:ListItem>
> </asp:radiobuttonlist>
> <script language="JavaScript"> function SetDeleted() {
> if(document. getElementById('U_Members1_rblDeleted_0'
).checked){
> document. getElementById('U_Members1_rblSendCard_1
').checked=true;
> document. getElementById('U_Members1_rblSendCard')
.disabled='disabled';}
> else{
> document. getElementById('U_Members1_rblSendCard')
.disabled='';}}</script>
> --
> Alphonse Giambrone
> Email: a-giam at customdatasolutions dot us
>
>
Thanks for the quick reply, Bill.
That certainly explains it.
Alphonse Giambrone
Email: a-giam at customdatasolutions dot us
"William F. Robertson, Jr." <theman@.nameht.org> wrote in message
news:eONsxwHMFHA.2736@.TK2MSFTNGP09.phx.gbl...
> When an html element is disabled, it is not posted in the Request.Forms
> Collection.
> bill
>
> "Alphonse Giambrone" <NOSPAMa-giam@.example.invalid> wrote in message
> news:uZGOHdHMFHA.1948@.TK2MSFTNGP14.phx.gbl...
> it.
> screen,
> rblSendCard,
> empty
> it
>