Showing posts with label webpage. Show all posts
Showing posts with label webpage. Show all posts

Saturday, March 24, 2012

the DataBound event of FormView

hey

asp.net 2.0

I want to programmatically populate (with data from the database) a label
control in a FormView on a webpage.

Is it a good idea to put my logic inside the DataBound event of the
FormView?

any other suggestions?

JeffThe basic databinding pattern with a FormView is the same as with similar
Databound controls such a GridView. Assuming that all your controls (inluding
the label) have their databound field set,

private void BindData()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
SqlDataAdapter ad = new SqlDataAdapter("SELECT * FROM Users",
myConnection);
DataSet ds = new DataSet();
ad.Fill(ds);
fv1.DataSource = ds;
fv1.DataBind();
FormViewRow row = fv1.Row;

}

You could call the above method inside an if(!Page.IsPostBack) check in your
Page_Load handler.

--Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Jeff" wrote:

Quote:

Originally Posted by

hey
>
asp.net 2.0
>
I want to programmatically populate (with data from the database) a label
control in a FormView on a webpage.
>
Is it a good idea to put my logic inside the DataBound event of the
FormView?
>
any other suggestions?
>
Jeff
>
>
>


Hey Peter!

thanks for your reply!

But I want to manipulate the data returned from the database before I set
display it in the FormView!

Instead of doing this:
<asp:TextBox ID="helloworldTextBox" runat="server" Text='<%#
Bind("helloworld") %>'>
</asp:TextBox><br />

I want to do something like this (in the code behind page):
helloworldTextBox.text = <db value>;

It's an interesting code you sent me, but I have this already configured. I
want to programmatically manipulate the data returned from db before I show
in the label control

Any suggestions?

"Peter Bromberg [C# MVP]" <pbromberg@dotnet.itags.org.yahoo.nospammin.comwrote in message
news:4C96A67E-E381-4F1C-B90B-0CA19F9C9326@dotnet.itags.org.microsoft.com...

Quote:

Originally Posted by

The basic databinding pattern with a FormView is the same as with similar
Databound controls such a GridView. Assuming that all your controls
(inluding
the label) have their databound field set,
>
private void BindData()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
SqlDataAdapter ad = new SqlDataAdapter("SELECT * FROM Users",
myConnection);
DataSet ds = new DataSet();
ad.Fill(ds);
fv1.DataSource = ds;
fv1.DataBind();
FormViewRow row = fv1.Row;
>
>
}
>
You could call the above method inside an if(!Page.IsPostBack) check in
your
Page_Load handler.
>
>
--Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
>
>
>
>
"Jeff" wrote:
>

Quote:

Originally Posted by

>hey
>>
>asp.net 2.0
>>
>I want to programmatically populate (with data from the database) a label
>control in a FormView on a webpage.
>>
>Is it a good idea to put my logic inside the DataBound event of the
>FormView?
>>
>any other suggestions?
>>
>Jeff
>>
>>
>>


This is the manipulation I need done to the db data:
String str = reader.GetString(4);
lblInfo.Text = str.Replace(Environment.NewLine, "<br/>");

Maybe I instead could do this data manipulation directly in the stored
procedure (sql server 2005) which returns the datasource to the FormView??

"Peter Bromberg [C# MVP]" <pbromberg@dotnet.itags.org.yahoo.nospammin.comwrote in message
news:4C96A67E-E381-4F1C-B90B-0CA19F9C9326@dotnet.itags.org.microsoft.com...

Quote:

Originally Posted by

The basic databinding pattern with a FormView is the same as with similar
Databound controls such a GridView. Assuming that all your controls
(inluding
the label) have their databound field set,
>
private void BindData()
{
SqlConnection myConnection = new SqlConnection(ConnectionString);
SqlDataAdapter ad = new SqlDataAdapter("SELECT * FROM Users",
myConnection);
DataSet ds = new DataSet();
ad.Fill(ds);
fv1.DataSource = ds;
fv1.DataBind();
FormViewRow row = fv1.Row;
>
>
}
>
You could call the above method inside an if(!Page.IsPostBack) check in
your
Page_Load handler.
>
>
--Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
>
>
>
>
"Jeff" wrote:
>

Quote:

Originally Posted by

>hey
>>
>asp.net 2.0
>>
>I want to programmatically populate (with data from the database) a label
>control in a FormView on a webpage.
>>
>Is it a good idea to put my logic inside the DataBound event of the
>FormView?
>>
>any other suggestions?
>>
>Jeff
>>
>>
>>

Tuesday, March 13, 2012

The language behind www.microsoft.com

The index http://www.microsoft.com/en/us/default.aspx has .aspx
extension, but it does not look like ASP.NET webpage. It does not have
__VIEWSTATE, it doesn't have <form> in the body... Just tones of
JavaScript.
Anyone any idea what is the language behind it?BTW it is the same with MSN.com. It is even XHTML Strict, which is
strange for Microsoft...
On 20 Mar 2007 11:35:25 -0700, georgi.ivanov@.gmail.com wrote:

> The index http://www.microsoft.com/en/us/default.aspx has .aspx
> extension, but it does not look like ASP.NET webpage. It does not have
> __VIEWSTATE, it doesn't have <form> in the body... Just tones of
> JavaScript.
> Anyone any idea what is the language behind it?
The aspx extension does not necessarily mean asp.net. For all we know they
may be using ruby on rails but mapped the .aspx extension to ruby!!! :)
--
Bits.Bytes
http://bytes.thinkersroom.com
On Mar 20, 7:35 pm, "georgi.iva...@.gmail.com"
<georgi.iva...@.gmail.com> wrote:
> The indexhttp://www.microsoft.com/en/us/default.aspxhas .aspx
> extension, but it does not look like ASP.NET webpage. It does not have
> __VIEWSTATE, it doesn't have <form> in the body... Just tones of
> JavaScript.
> Anyone any idea what is the language behind it?
it's not a language, it's Microsoft Office SharePoint Server 2007

The language behind www.microsoft.com

The index http://www.microsoft.com/en/us/default.aspx has .aspx
extension, but it does not look like ASP.NET webpage. It does not have
__VIEWSTATE, it doesn't have <formin the body... Just tones of
JavaScript.

Anyone any idea what is the language behind it?BTW it is the same with MSN.com. It is even XHTML Strict, which is
strange for Microsoft...
On 20 Mar 2007 11:35:25 -0700, georgi.ivanov@.gmail.com wrote:

Quote:

Originally Posted by

The index http://www.microsoft.com/en/us/default.aspx has .aspx
extension, but it does not look like ASP.NET webpage. It does not have
__VIEWSTATE, it doesn't have <formin the body... Just tones of
JavaScript.
>
Anyone any idea what is the language behind it?


The aspx extension does not necessarily mean asp.net. For all we know they
may be using ruby on rails but mapped the .aspx extension to ruby!!! :)
--
Bits.Bytes
http://bytes.thinkersroom.com
On Mar 20, 7:35 pm, "georgi.iva...@.gmail.com"
<georgi.iva...@.gmail.comwrote:

Quote:

Originally Posted by

The indexhttp://www.microsoft.com/en/us/default.aspxhas .aspx
extension, but it does not look like ASP.NET webpage. It does not have
__VIEWSTATE, it doesn't have <formin the body... Just tones of
JavaScript.
>
Anyone any idea what is the language behind it?


it's not a language, it's Microsoft Office SharePoint Server 2007

The Main CSS Question?

Ok first off I'll happily admit that I've went and made a bad design decition when starting my webpage, At first I was totally focused on functionality and only very basic layout, but now that I'm nearing the end of my functionality I've started looking closer at my CSS Design and I've came accross the main CSS question......and that is what kind of screen resolution should I build my site for?

I want to favor to the majority of people and the last survey that came out said the majority of people are using a screen resolution of 800x600 pixals, however I also believe my site is actually for more intermediate computer users with a screen resolution of 1024x768 pixals so I could build it for a screen resolution of 800x600 which would also work for the 1024x768 resolution but I also want the users with the 1024x768 screen resolution to view the page on full screen and not have the white spaces...

I do not like using Percentages I woud rather set my items in pixals, I've found that percentages dont have the level of accuracy that pixals do, so what I thought I would do is build two different CSS Classes one completly for 800x600 and another for 1024x768 and have a kinda pre-entry to my website where the user can choose which screen resolution they want to view the site in...

So my question......Is it possible to do this, I am a bit unsure of how I can set up a button so when clicked the CSS for that resolution is set....here is a bit of an example of what I mean

User 1 comes to the site, see's a screen that says please pick a resolution, they pick 800x600 and continue on to the site viewing it perfectly in full screen, now user 2 comes around and picks 1024x768 resolution and instead of calling the 800x600 CSS Classes it calls for the 1024x768 classes to be used...

You can do that. Or you can design so that it doesn't matter what the user's resolution is. You might look at the Themes and Skins options.

Jeff


Yeah if I can design it so it doesnt matter what the screen resolution is would be perfect I know a couple possible way's to do it, basicly have some containers with percentages and have the content within those containers pixels.....but I will definatly look into the Themes and skins option as well...

Thanks.


Here is what might be a dumb question but I'm still going to ask it, just because if there is a way to do it... Then my life becomes a thousand times easier right now....by any chance can you have your webpage programmed to detect what kind of screen resolution that the user is using?.....

I know you can detect there IP Address and a whole lot of other information so I thought I would ask...