Showing posts with label contains. Show all posts
Showing posts with label contains. Show all posts

Wednesday, March 28, 2012

text encoding problem in GridView .Net 2.0

Hi guys!
i've got very interesting problem. the problem is like this.
i've 2 webpages.
-- page1 contains DataGrid control of .Net 1.1 and
-- Page2 contains GridView control of .Net 2.0.
-- both grid displays same data and same function is used to fetch data
from the database.
the grid on Page1 displays data correctly but i've got problem with the
grid of Page2.
in one column which shows NVARCHAR data,
the data shown on Page1 is like this
ab=E6cd=F8ef=E5
and the same text is diaplyed differently on Page2 Grid like this,
abæcdøefå
it seems problem with encoding but i'm not able to find out how to fix
this.
i'm using C#.NET 2.0 and MS SQL SERVER 2000
can anyone help me out here? i would appriciate it.
Thanks,
Luckyhi guys!
again me. i found the problem. it wasn't with the GridView. so do not
bother about this.
Lucky
Lucky wrote:
> Hi guys!
> i've got very interesting problem. the problem is like this.
> i've 2 webpages.
> -- page1 contains DataGrid control of .Net 1.1 and
> -- Page2 contains GridView control of .Net 2.0.
> -- both grid displays same data and same function is used to fetch data
> from the database.
> the grid on Page1 displays data correctly but i've got problem with the
> grid of Page2.
> in one column which shows NVARCHAR data,
> the data shown on Page1 is like this
> ab=E6cd=F8ef=E5
> and the same text is diaplyed differently on Page2 Grid like this,
> abæcdøefå
> it seems problem with encoding but i'm not able to find out how to fix
> this.
> i'm using C#.NET 2.0 and MS SQL SERVER 2000
> can anyone help me out here? i would appriciate it.
>=20
> Thanks,
> Lucky
hi guys!
again me. i found the problem. it wasn't with the GridView. so do not
bother about this.
Lucky
Lucky wrote:
> Hi guys!
> i've got very interesting problem. the problem is like this.
> i've 2 webpages.
> -- page1 contains DataGrid control of .Net 1.1 and
> -- Page2 contains GridView control of .Net 2.0.
> -- both grid displays same data and same function is used to fetch data
> from the database.
> the grid on Page1 displays data correctly but i've got problem with the
> grid of Page2.
> in one column which shows NVARCHAR data,
> the data shown on Page1 is like this
> ab=E6cd=F8ef=E5
> and the same text is diaplyed differently on Page2 Grid like this,
> abæcdøefå
> it seems problem with encoding but i'm not able to find out how to fix
> this.
> i'm using C#.NET 2.0 and MS SQL SERVER 2000
> can anyone help me out here? i would appriciate it.
>=20
> Thanks,
> Lucky

Thursday, March 22, 2012

Text value does not stay the same when updated...

Hello:

I am in a very weird situation and hope that someone can help me shed some light on this...

I have a form that contains two textboxes, in one text box it asks for the users first name, in the other textbox it shows a template message that will be sent to the user...

So in my code I have on


If page.ispostback = "false" Then
txttemplatemessage.text = "Hello " & txtfirstname.text & "<custom message goes here>"
End If

With the above code, when the form is updated and a custom message is inserted... It works just fine... But if you tried to make changes to the txtfirstname.text, it does not accept the changes since it checks for ispostback = "false"...

Then When I try the following:


txttemplatemessage.text = "Hello " & txtfirstname.text & "<custom message goes here>"

With the above code, when the form is udpated the custom message inserted in the actual txttemplatemessage, does not show, since it overrides with when the information is posted back... But the txtfirstname update works fine...

How can I make both of these work? While still keeping the same logic if possible... Any suggestions?A wild shot...


If page.ispostback = "false" Then

txttemplatemessage.text = "Hello " & txtfirstname.text & "<custom message goes here>"
Else

If txtfirstname.text <> String.Empty Then
txttemplatemessage.text = "Hello " & txtfirstname.text & "<custom message goes here>"
End if

End If


That would not work since during the post back it re-assigns the values back to txttemplatemessage... so if the user had changed the message in there, his updated changes would just disappear with the generic template again... Any other suggestions?

Tuesday, March 13, 2012

TextBox and Button

Hey guys...
In my aspx page I have a textbox that when the user press Return I need to
click a button. How can I do it?
OR
All the pages that contains buttons have a default button, but I don't know
how to define the default button. If I do it, my problem will be solved.
Thank'shttp://www.dotnetspider.com/Technol...px?SampleId=212
"Andr Almeida Maldonado" <deweb@.bol.com.br> wrote in message
news:u9d7HtyUEHA.2692@.TK2MSFTNGP09.phx.gbl...
> Hey guys...
> In my aspx page I have a textbox that when the user press Return I need to
> click a button. How can I do it?
> OR
> All the pages that contains buttons have a default button, but I don't
> know
> how to define the default button. If I do it, my problem will be solved.
>
> Thank's
>
Hy Ken
I make this:
<asp:textbox id="txtEntrPrCB" onKeyDown="KeyDownHandler('btnEntrPrMa')"
.....
But when I press Enter, I receive this error:
Object doesn't suport this property or method.
WHY'? What I'm doing wrong?
Thank's
"Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> escreveu na mens
agem
news:OFjqo8yUEHA.2668@.TK2MSFTNGP10.phx.gbl...
> http://www.dotnetspider.com/Technol...px?SampleId=212
> "Andr Almeida Maldonado" <deweb@.bol.com.br> wrote in message
> news:u9d7HtyUEHA.2692@.TK2MSFTNGP09.phx.gbl...
to
>
There may be some errant spaces in the code.
How about this?
Ken
<!-->
<%@. Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script language="javascript">
function KeyDownHandler(btn)
{
// process only the Enter key
if (event.keyCode == 13)
{
// cancel the default submit
event.returnValue=false;
event.cancel = true;
// submit the form by programmatically clicking the specified
button
alert('Clicked');
btn.click();
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button Runat="server" ID="DefButton" />
<asp:TextBox Runat="server" ID="FirstName"
onKeyDown="KeyDownHandler(DefButton)" />
</div>
</form>
</body>
</html>
<!-->
"Andr Almeida Maldonado" <deweb@.bol.com.br> wrote in message
news:OWahAJzUEHA.2716@.tk2msftngp13.phx.gbl...
> Hy Ken
> I make this:
> <asp:textbox id="txtEntrPrCB" onKeyDown="KeyDownHandler('btnEntrPrMa')"
> .....
> But when I press Enter, I receive this error:
> Object doesn't suport this property or method.
>
> WHY'? What I'm doing wrong?
>
> Thank's
>
> "Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> escreveu na
> mensagem
> news:OFjqo8yUEHA.2668@.TK2MSFTNGP10.phx.gbl...
> to
>
Andre,
The code Ken gave you will work, but event.KeyCode will only work for IE and
not netscape. If you want to, I have a bunch of useful javascripts all
rolled into a single component on my website, www.aboutfortunate.com. Click
the code library link on the top right of the page and then click the
javascript button in the menu on the left.
All code on my site is free and the full .NET v1.1 project is downloadable.
So even if you don't want to use the object as is you can get some decent
code examples from it.
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Andr Almeida Maldonado" <deweb@.bol.com.br> wrote in message
news:OWahAJzUEHA.2716@.tk2msftngp13.phx.gbl...
> Hy Ken
> I make this:
> <asp:textbox id="txtEntrPrCB" onKeyDown="KeyDownHandler('btnEntrPrMa')"
> .....
> But when I press Enter, I receive this error:
> Object doesn't suport this property or method.
>
> WHY'? What I'm doing wrong?
>
> Thank's
>
> "Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> escreveu na
mensagem
> news:OFjqo8yUEHA.2668@.TK2MSFTNGP10.phx.gbl...
need
> to
solved.
>
hy
here is some code snippet:
--
put next code in Page_Load
TextBox1.Attributes.Add("onkeypress",
"if(event.keyCode==65)Form1.Button1.onclick();")
when you press 'A' in TextBox,preseding code excute
You can intercept the client side enter keypress event of the text box and
then do what you want using javascript code.
Here's a good example:
http://www.kamp-hansen.dk/pages/sho...id=21&menuid=18
You could also try using this free control.
http://www.metabuilders.com/tools/DefaultButtons.aspx
And here's a couple good articles on the subject:
http://www.allasp.net/enterkey.aspx
http://www.aspnetpro.com/features/2...p200406so_f.asp
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"Andr Almeida Maldonado" <deweb@.bol.com.br> wrote in message
news:u9d7HtyUEHA.2692@.TK2MSFTNGP09.phx.gbl...
> Hey guys...
> In my aspx page I have a textbox that when the user press Return I need to
> click a button. How can I do it?
> OR
> All the pages that contains buttons have a default button, but I don't
know
> how to define the default button. If I do it, my problem will be solved.
>
> Thank's
>

TextBox and Button

Hey guys...

In my aspx page I have a textbox that when the user press Return I need to
click a button. How can I do it?

OR

All the pages that contains buttons have a default button, but I don't know
how to define the default button. If I do it, my problem will be solved.

Thank'shttp://www.dotnetspider.com/Technol...px?SampleId=212

"Andr Almeida Maldonado" <deweb@.bol.com.br> wrote in message
news:u9d7HtyUEHA.2692@.TK2MSFTNGP09.phx.gbl...
> Hey guys...
> In my aspx page I have a textbox that when the user press Return I need to
> click a button. How can I do it?
> OR
> All the pages that contains buttons have a default button, but I don't
> know
> how to define the default button. If I do it, my problem will be solved.
>
> Thank's
Hy Ken

I make this:

<asp:textbox id="txtEntrPrCB" onKeyDown="KeyDownHandler('btnEntrPrMa')"
......

But when I press Enter, I receive this error:

Object doesn't suport this property or method.

WHY??? What I'm doing wrong?

Thank's

"Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> escreveu na mensagem
news:OFjqo8yUEHA.2668@.TK2MSFTNGP10.phx.gbl...
> http://www.dotnetspider.com/Technol...px?SampleId=212
> "Andr Almeida Maldonado" <deweb@.bol.com.br> wrote in message
> news:u9d7HtyUEHA.2692@.TK2MSFTNGP09.phx.gbl...
> > Hey guys...
> > In my aspx page I have a textbox that when the user press Return I need
to
> > click a button. How can I do it?
> > OR
> > All the pages that contains buttons have a default button, but I don't
> > know
> > how to define the default button. If I do it, my problem will be solved.
> > Thank's
There may be some errant spaces in the code.

How about this?

Ken

<!--->
<%@. Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<script language="javascript">
function KeyDownHandler(btn)
{
// process only the Enter key
if (event.keyCode == 13)
{
// cancel the default submit
event.returnValue=false;
event.cancel = true;
// submit the form by programmatically clicking the specified
button
alert('Clicked');
btn.click();
}
}
</script
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button Runat="server" ID="DefButton" />
<asp:TextBox Runat="server" ID="FirstName"
onKeyDown="KeyDownHandler(DefButton)" />
</div>
</form>
</body>
</html>
<!---
"Andr Almeida Maldonado" <deweb@.bol.com.br> wrote in message
news:OWahAJzUEHA.2716@.tk2msftngp13.phx.gbl...
> Hy Ken
> I make this:
> <asp:textbox id="txtEntrPrCB" onKeyDown="KeyDownHandler('btnEntrPrMa')"
> .....
> But when I press Enter, I receive this error:
> Object doesn't suport this property or method.
>
> WHY??? What I'm doing wrong?
>
> Thank's
>
> "Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> escreveu na
> mensagem
> news:OFjqo8yUEHA.2668@.TK2MSFTNGP10.phx.gbl...
>> http://www.dotnetspider.com/Technol...px?SampleId=212
>>
>> "Andr Almeida Maldonado" <deweb@.bol.com.br> wrote in message
>> news:u9d7HtyUEHA.2692@.TK2MSFTNGP09.phx.gbl...
>> > Hey guys...
>>> > In my aspx page I have a textbox that when the user press Return I need
> to
>> > click a button. How can I do it?
>>> > OR
>>> > All the pages that contains buttons have a default button, but I don't
>> > know
>> > how to define the default button. If I do it, my problem will be
>> > solved.
>>>> > Thank's
>>>>
Andre,

The code Ken gave you will work, but event.KeyCode will only work for IE and
not netscape. If you want to, I have a bunch of useful javascripts all
rolled into a single component on my website, www.aboutfortunate.com. Click
the code library link on the top right of the page and then click the
javascript button in the menu on the left.

All code on my site is free and the full .NET v1.1 project is downloadable.
So even if you don't want to use the object as is you can get some decent
code examples from it.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Andr Almeida Maldonado" <deweb@.bol.com.br> wrote in message
news:OWahAJzUEHA.2716@.tk2msftngp13.phx.gbl...
> Hy Ken
> I make this:
> <asp:textbox id="txtEntrPrCB" onKeyDown="KeyDownHandler('btnEntrPrMa')"
> .....
> But when I press Enter, I receive this error:
> Object doesn't suport this property or method.
>
> WHY??? What I'm doing wrong?
>
> Thank's
>
> "Ken Cox [Microsoft MVP]" <BANSPAMken_cox@.sympatico.ca> escreveu na
mensagem
> news:OFjqo8yUEHA.2668@.TK2MSFTNGP10.phx.gbl...
> > http://www.dotnetspider.com/Technol...px?SampleId=212
> > "Andr Almeida Maldonado" <deweb@.bol.com.br> wrote in message
> > news:u9d7HtyUEHA.2692@.TK2MSFTNGP09.phx.gbl...
> > > Hey guys...
> > > > In my aspx page I have a textbox that when the user press Return I
need
> to
> > > click a button. How can I do it?
> > > > OR
> > > > All the pages that contains buttons have a default button, but I don't
> > > know
> > > how to define the default button. If I do it, my problem will be
solved.
> > > > > Thank's
> >
hy
here is some code snippet:
-----------
put next code in Page_Load
TextBox1.Attributes.Add("onkeypress",
"if(event.keyCode==65)Form1.Button1.onclick();")
when you press 'A' in TextBox,preseding code excute
You can intercept the client side enter keypress event of the text box and
then do what you want using javascript code.
Here's a good example:
http://www.kamp-hansen.dk/pages/sho...id=21&menuid=18

You could also try using this free control.
http://www.metabuilders.com/tools/DefaultButtons.aspx

And here's a couple good articles on the subject:
http://www.allasp.net/enterkey.aspx
http://www.aspnetpro.com/features/2...p200406so_f.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net

"Andr Almeida Maldonado" <deweb@.bol.com.br> wrote in message
news:u9d7HtyUEHA.2692@.TK2MSFTNGP09.phx.gbl...
> Hey guys...
> In my aspx page I have a textbox that when the user press Return I need to
> click a button. How can I do it?
> OR
> All the pages that contains buttons have a default button, but I don't
know
> how to define the default button. If I do it, my problem will be solved.
>
> Thank's