Showing posts with label grid. Show all posts
Showing posts with label grid. Show all posts

Thursday, March 29, 2012

official alternative to ajax

Hi

I have asked this on the official asp.net forums but no luck so
thought I'd try here

Assume you have a page with a filter control and a grid view and many
other controls on it. When the filter changes you want the gridview to
change but nothing else. In particular all you would like to happen is
for an ajax call to occur and a new grid view to be returned.

Similarily you might have a treeview working asynchronously, you might
have an n'tiered arrangment and if the database disappears you would
want a different control on the page to indicate this, but the treeview
can't be connected to other controls in this manner (can it?)

That kind of situation is possible with Raw html and Ajax. Obviously
ajax calls are easy enough (especially using something like AjaxPro)
and to get the a table back you could just create it and return it.
Similiarly for the treeview example you could return an li/ul structure
normally plus a different control to indicate the error.

So, my question. What is the official way to do things like this. I
suspect the answer is use a postback

ta

(sig: findbyfoldface)I see a lot of people trying to avoid postback, as they feel painting the
page over again is somehow inferior to doing some voodoo in the back with
Ajax. And, in some cases, they are correct. In others, they are creating two
data transports that they have to maintain, simply to avoid a repaint. I do
not see this as a wise use of Ajax, but everyone has their own opinion.

You can talk to controls all day long on the client side and even wire them
to Ajax calls. If you like, you can code your own via the XMLHTTP and with
SOAP even make true web service calls from the client. As long as you emit
the client script from your code beside (behind?) page, you can get the name
of the control, no matter where it is placed, and you can then have one
control pounding on another without a complete postback.

The question is whether you want to maintain this architecture.

PROS
1. It does not completely repaint the page

CONS
1. Harder to debug a mix of client and server script
2. Less maintainable

The main benefit of Ajax (yes, I realize there are many other reasons to use
it ;->) is user accessibility. For example, the google toolbar approach
where a drop down is created on the fly or the ability to change states
based on a country, or fill in a list of cities based on a postal code.
These are very valid reasons to use an asyncrhronous transport. I do not, in
general, believe that gathering a full spreadsheet of data is the best use
for asynch (although there are certainly some specific examples when it
would be wise).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
*************************************************
Think outside of the box!
*************************************************
<codefragment@.googlemail.comwrote in message
news:1159878333.734722.257200@.e3g2000cwe.googlegro ups.com...

Quote:

Originally Posted by

Hi
>
I have asked this on the official asp.net forums but no luck so
thought I'd try here
>
Assume you have a page with a filter control and a grid view and many
other controls on it. When the filter changes you want the gridview to
change but nothing else. In particular all you would like to happen is
for an ajax call to occur and a new grid view to be returned.
>
Similarily you might have a treeview working asynchronously, you might
have an n'tiered arrangment and if the database disappears you would
want a different control on the page to indicate this, but the treeview
can't be connected to other controls in this manner (can it?)
>
That kind of situation is possible with Raw html and Ajax. Obviously
ajax calls are easy enough (especially using something like AjaxPro)
and to get the a table back you could just create it and return it.
Similiarly for the treeview example you could return an li/ul structure
normally plus a different control to indicate the error.
>
So, my question. What is the official way to do things like this. I
suspect the answer is use a postback
>
ta
>
(sig: findbyfoldface)
>

official alternative to ajax

Hi
I have asked this on the official asp.net forums but no luck so
thought I'd try here
Assume you have a page with a filter control and a grid view and many
other controls on it. When the filter changes you want the gridview to
change but nothing else. In particular all you would like to happen is
for an ajax call to occur and a new grid view to be returned.
Similarily you might have a treeview working asynchronously, you might
have an n'tiered arrangment and if the database disappears you would
want a different control on the page to indicate this, but the treeview
can't be connected to other controls in this manner (can it?)
That kind of situation is possible with Raw html and Ajax. Obviously
ajax calls are easy enough (especially using something like AjaxPro)
and to get the a table back you could just create it and return it.
Similiarly for the treeview example you could return an li/ul structure
normally plus a different control to indicate the error.
So, my question. What is the official way to do things like this. I
suspect the answer is use a postback
ta
(sig: findbyfoldface)I see a lot of people trying to avoid postback, as they feel painting the
page over again is somehow inferior to doing some voodoo in the back with
Ajax. And, in some cases, they are correct. In others, they are creating two
data transports that they have to maintain, simply to avoid a repaint. I do
not see this as a wise use of Ajax, but everyone has their own opinion.
You can talk to controls all day long on the client side and even wire them
to Ajax calls. If you like, you can code your own via the XMLHTTP and with
SOAP even make true web service calls from the client. As long as you emit
the client script from your code beside (behind?) page, you can get the name
of the control, no matter where it is placed, and you can then have one
control pounding on another without a complete postback.
The question is whether you want to maintain this architecture.
PROS
1. It does not completely repaint the page
CONS
1. Harder to debug a mix of client and server script
2. Less maintainable
The main benefit of Ajax (yes, I realize there are many other reasons to use
it ;-> ) is user accessibility. For example, the google toolbar approach
where a drop down is created on the fly or the ability to change states
based on a country, or fill in a list of cities based on a postal code.
These are very valid reasons to use an asyncrhronous transport. I do not, in
general, believe that gathering a full spreadsheet of data is the best use
for asynch (although there are certainly some specific examples when it
would be wise).
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
****************************************
*********
Think outside of the box!
****************************************
*********
<codefragment@.googlemail.com> wrote in message
news:1159878333.734722.257200@.e3g2000cwe.googlegroups.com...
> Hi
> I have asked this on the official asp.net forums but no luck so
> thought I'd try here
> Assume you have a page with a filter control and a grid view and many
> other controls on it. When the filter changes you want the gridview to
> change but nothing else. In particular all you would like to happen is
> for an ajax call to occur and a new grid view to be returned.
> Similarily you might have a treeview working asynchronously, you might
> have an n'tiered arrangment and if the database disappears you would
> want a different control on the page to indicate this, but the treeview
> can't be connected to other controls in this manner (can it?)
> That kind of situation is possible with Raw html and Ajax. Obviously
> ajax calls are easy enough (especially using something like AjaxPro)
> and to get the a table back you could just create it and return it.
> Similiarly for the treeview example you could return an li/ul structure
> normally plus a different control to indicate the error.
> So, my question. What is the official way to do things like this. I
> suspect the answer is use a postback
> ta
> (sig: findbyfoldface)
>

Thursday, March 22, 2012

OleDbDataAdapter Configuration On Server? :(

Hi,

I am using OleDbDataAdapter to implement data grid web control and to configure the database connection i have to provide it with the provider and database name... as i am using access database so i select the provider as Jet Microsoft .... and then i have to browse for my database file and the connection gets created,

Now the problem is when i post the thing on my server it still looks for the path C:\inetpub\db\..... how can i configure that for the server. I tried to change the path in code window as ../db/... somthing like that but it didnt work ... plz help.

Thanks,
imranFor a database connection you have to use a physical path and not a relative path. To do what you are looking to acomplish you have to use "server.mappath" and the virtual path as follows:"


dim DBname as string = server.mappath("mydb.mdb")

then just plug the DBname string into your connection string
Hi,

I have used the mappath thing everywhere in my code but i dont know how to use it with the OleDbDataAdapter control as when u right click on the control it gives an option to configure the control and there i am not able to find a way to relate my access database file with server mappath .. it just lets me to browse the database file on the hard drive.
plzz suggest a way,

thanks,
imran
post the code of your page and i'll show you what to do

Friday, March 16, 2012

On Page Load, looking to see if Grid is populated.

I have run into this a few times looking for a Textbox located inside of a form or a gridview inside of a loginview.

If it's not inside of the FormView, Intellisense picks it right up. how can I get Gridview2 located inside of the formview to check at page_load?


<script runat="server"
protected void Page_Load(object sender, EventArgs e)
{

}
</script
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table style="width: 100%">
<tr>
<td style="width: 100px; vertical-align: top; text-align: left;">
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
<asp:Login ID="Login1" runat="server" CreateUserText="Need to Register?" CreateUserUrl="~/Signup.aspx" PasswordRecoveryText="Forget your Password?" PasswordRecoveryUrl="~/PasswordRecovery.aspx" Height="208px">
</asp:Login>
</AnonymousTemplate>
<LoggedInTemplate>
Welcome Back
<asp:LoginName ID="LoginName1" runat="server" />
<br />
<table style="; position: static">
<tr>
<td style="width: 100px">
</td>
</tr>
<tr>
<td style="width: 400px">
<span style="font-size: 14pt; color: dimgray"><strong>Today's Sales<asp:Label ID="Label6"
runat="server" Text="Today's Sales Label"></asp:Label></strong></span></td>
</tr>
<tr>
<td style="width: 400px">
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" BackColor="LightGoldenrodYellow"
BorderColor="Tan" BorderWidth="1px" CellPadding="2" DataSourceID="SqlDataSource2"
ForeColor="Black" GridLines="None" Style="width: 400px">
<FooterStyle BackColor="Tan" />
<Columns>

In your supplied code, there is no FormView. Your GridView however is within a LoginView which requires that you be logged in to have access to the GridView.