|
navneeth is right..
this is total wastage fo resources if unnecessary post backs are there... try to minimize the post backs and even the use of RUNAT="SERVER" controls wherever possible..
try to use simple HTML labels instead of asp:labels. it reduces server traffic and round trips and increases user acceptance to a very high level.
cheers...!
Ashish Sehajpal
|
|
|
|
|
How can i run the downloded Custom control Projects downloded from this site, other than the instruction given in the zip?
Is there any possiblity to get exe files for the projects
modified on Saturday, April 5, 2008 1:04 AM
|
|
|
|
|
You need to ask this on the article's discussion board from where you downloaded the zip file.
|
|
|
|
|
Hi all,
I have a page to remove Items from a database, the page layout is as follows:
---------------------------------
Item1 Description [Remove Button]
---------------------------------
---------------------------------
Item2 Description [Remove Button]
---------------------------------
.
.
---------------------------------
ItemN Description [Remove Button]
---------------------------------
Now, when I click on the remove button the item is removed from the database but when the page is submitted and reloaded, the removed item stays in the page contents (despite it was removed from the database) until you REFRESH the page. It seems that the browser reloads the page from the cache but I don't want this to happen, I want the changes to be reflected instantly.
BTW: the Item description and the remove button are wrapped in a web user control, I hope that this does not complicate the solution
Thanks
Mohammad Gdeisat
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
just try:-
1. disable the response cachebility
Response.Cache.SetCacheability(HttpCacheability.NoCache)
2. bind the grid again on update command
may be helpful for you....
Ashish Sehajpal
|
|
|
|
|
I am trying to databind an image to a repeater control. The problem is when i execute the procedure the image isn't appearing. Below is the code for both page and behind:
<asp:Repeater ID="rpt_content" Runat="server">
<ItemTemplate>
<h2><%#DataBinder.Eval(Container.DataItem, "Article_Title")%></h2>
<asp:Image ID="img_article" runat="server" ImageUrl='<%#DataBinder.Eval(Container.DataItem, "Article_Image")%>' />
<%#DataBinder.Eval(Container.DataItem, "Article_Content")%>
<%#DataBinder.Eval(Container.DataItem, "Article_Image")%>
</ItemTemplate>
</asp:Repeater>
Private Sub Repeater_Content()
Dim Select_Content As New SqlCommand("Select_Content", conn)
Dim da As New SqlDataAdapter(Select_Content)
Dim dt As New DataTable
conn.Open()
Try
Select_Content.CommandType = CommandType.StoredProcedure
Select_Content.ExecuteNonQuery.ToString()
da.Fill(dt)
Catch ex As Exception
Finally
conn.Close()
End Try
rpt_content.DataSource = dt
rpt_content.DataBind()
End Sub
|
|
|
|
|
hey mc....
use html image object instead..... it is more functional in real life...
<img src='<%# Eval("Article_Image") >' alt='' />
cheers !
Ashish Sehajpal
|
|
|
|
|
Hi, i'm creating a TextBox dynamically with the firing of a Button
but every time the page posts back the previous TextBox disappears. Is there
a way to retain that control and add the new ones below it?
Your help is greatly appreciated!
Fivos
|
|
|
|
|
hi phivos,
the concept here is that the server recognizes the controls that are present in the design view of the page... and produces the HTML code for those.
the control you created is dynamic and will be maintained only if their is some logic to add that control every time. we can a collection object declared and add a key value pair for that control i.e. "textbox1" , "value in textbox entered by user"
and add it to that collection and keep that collection object in viewstate. everytime in page load, check for number of key-value pairs in that object and run a loop to add that much controls with id as key and TEXT as value for that key...
simple solution
cheers..!
Ashish Sehajpal
|
|
|
|
|
|
if you are adding control(s) dynamically on the page, you will loos all the added controls on postback.
To avoid this...you need to understand the fundamental of aspx.
on the postback page is loosing all the dynamically added controls. Basically all the controls are available on the page, but page can not retrive them from viewstate.
You need to make rememebr the ids of dynamica added controls to the page.
ie. if you are added 2 textboxes on the page and giving ids like txt.ID="txt" +1 and for second txt.ID="txt" +2. so on the page load write the code to add the two textboxes and assign the same ids, so, page autometically will retain the text entered in the textbox on the postback.
Enjoy
|
|
|
|
|
Guru's
I have finally learned how to program Windows Services and they have been going fairly well. I even was able to create a windows app that checked the status every minute of the 2 services I created.
Now my issue: I used a ServiceController component to expose the methods to display the Status of the services and to start the service. I wanted to create a web form that could do the same but the ServiceController is grayed out when I try to use it on the Web Form. Is there anyway that I could achieve the same goal in a webform as I did with the Windows form?
Looking forward to all responses.
|
|
|
|
|
|
Hi, I have been trying to get this to work for a few days and tried searching everywhere but can't seem to find anything about this.
I am trying to login and make a post to a site. I have no problem logging into the site, however, when I go to make a post, nothing happens. After using Fiddler and comparing the results of the webbrowser and httprequest it looks like the boundary changes at each login.
For instance it will be this one time:
Content-Type: multipart/form-data; boundary=---------------------------7d829cb4c0502
and then it will be something like this (just slightly different) the next time:
Content-Type: multipart/form-data; boundary=---------------------------7d82b824c0502
I am trying to figure out how to get this information from the headers. Here is part of my code
<code>
httpWebRequest myRequest =(HttpWebRequest)WebRequest.Create(urlUri);
myRequest.CookieContainer = cookies;
myRequest.Method = "POST";
myRequest.AllowWriteStreamBuffering = true;
myRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)";
myRequest.Referer = "urlReferer";
myRequest.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, */*";
Stream newStream = myRequest.GetRequestStream();
newStream.Write(buffer,0,buffer.Length);
newStream.Close();
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myRequest.GetResponse();
HttpWebResponse resp = (HttpWebResponse)myRequest.GetResponse();
string[] names = resp.Headers.AllKeys;
string headerInfo = "";
Console.WriteLine("{0,-20}{1}\n", "Name", "Value");
foreach (string n in names)
headerInfo = headerInfo + <br /> + n + ": " + resp.Headers[n]; // Get the headers
resp.Close();
return headerInfo;
</code>
but this always returns
Content-Type: text/html
for the header instead of
Content-Type: multipart/form-data with the form boundary after it.
Is there anyway I can get the header information? I know it has to be possible.
Thanks
|
|
|
|
|
I'm not sure what you are trying to do. Is you problem in processing the response from the server? What do you get when you process the response stream? HttpWebResponse.GetResponseStream()
led mike
|
|
|
|
|
Thanks for the reply. I was having problems getting the boundary but think I got it figured out by using httpcontext to send the form data.
|
|
|
|
|
I have added a CheckBox to the EditItemTemplate and ItemTemplate in a GridView TemplateField. The checkbox does not show up in the ItemTemplate unless I set Enabled to true, but when I do this the checkbox is clickable. I would like to have a greyed out, readonly, checkbox in the ItemTemplate, so the user does not try to check or uncheck it, but can see its state. Is there a way to make a readonly, greyed out, checkbox in the ItemTemplate?
Thanks!
|
|
|
|
|
I resolved my issue and wanted to share in case someone else encounters this. Instead of using an ASP Checkbox, I changed to an HTML Checkbox and set disabled=disabled which worked. I don't understand why setting enabled to false on an ASP checkbox didn't do the same thing, but it didn't.
P.S. I am using Master Pages with the GridView inside a Panel.
|
|
|
|
|
Hi guys,
I have a table set to 100% width of the window. And style="text-align:center"
Inside the table I have a gridview.
When I view the site in IE it displayes the grid in the center of the table, but in firefox it displays the grid in the left of the table.
Does anyone know why this happens and how to get it fixed?
Thanks in advance
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
NeroToxic wrote: Does anyone know why this happens and how to get it fixed?
Yes it is a well known issue that browsers are not equal. Well known since like the very first ones.
Google: Browser Compatibility
led mike
|
|
|
|
|
This happens because there is a bug/feature in IE that makes it apply text alignment to block elements. Text alignment should only be applied to inline elements, that's why Firefox doesn't apply it to the grid.
Use margin-left:auto;margin-right:auto; on the grid to center it.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
The grid does not have the attribute margin nor style.
Thanks for the help, I used center align on td and that worked like a dream.
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
have u tried the align attribute for the TD yet?
<td align=center> <asp:gridview ..... /> </td>
Ashish Sehajpal
|
|
|
|
|
honestly I have no idea why I didn't think of that.
Thanks, works like a dream
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
Environment:
Visual Web developer 2008
ASP.NET 3.5
I want to make a cascading dropdownlist to retrieve data from a database.
I Want to have 2 dropdownlists. The first one eg. STATE will determine
the values available in the second dropdownlist eg. CITIES
The values selected in the two dropdownlists will then be passed to the
parameters in the SELECT statement for execution.
Thanks in advance
|
|
|
|