|
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
|
|
|
|
|
Hai,
I am Hari.........
while i am building project i am getting this error, i can't understand what is the problem......
error is
Error 1 Could not load type 'SmartAds.Global'. c:\inetpub\wwwroot\project\Global.asax 1
In the browser i am getting like this
Parser Error <br />
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. <br />
<br />
Parser Error Message: Could not load type 'SmartAds.Global'.<br />
<br />
Source Error: <br />
<br />
<br />
Line 1: <%@ Application Inherits="SmartAds.Global" Language="C#" %><br />
<br />
<br />
<br />
Source File: /project/global.asax Line: 1 <br />
<br />
<br />
--------------------------------------------------------------------------------<br />
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42 <br />
Please give the answer<br />
Thanks
Pinna
|
|
|
|
|
Whats smartads.Global? Do you have that file in your project?
|
|
|
|
|
Ya i have that file in my project...
|
|
|
|
|
Hi,
I want to give fixed rows to the datalist.
How can I do this?
Thanks
|
|
|
|
|
Hi guys.
I'm building APS.NET (VB) site that connects to Communicator API to get user status (phone list).
The code works fine on local machine (when I test or access my site thourhg localhost) but when I install the site on a server or try to access my dev machine it from a network if throws me:
Retrieving the COM class factory for component with CLSID {8885370D-B33E-44B7-875D-28E403CF9270} failed due to the following error: 80080005.
This line fails
communicator = New CommunicatorAPI.MessengerClass
Thanks for your help.
Alex.
|
|
|
|
|
|
Hello Friend!
I've created a page that create runtime control as follows
HtmlAnchor ha = new HtmlAnchor();
ha.InnerHtml = "";
but instead of displaying image, it shows alter text.
when i create the img tag at design time it shows the image.i.e., path is ok.
Please help me to show the image.
Thanks
|
|
|
|