|
hi ,
i have not done any html coding. i have created this web pages using Visual studio2005. i have two web pages.First web page is having logo and login box .. second page links to various reports. i have used standard controls from the toolbox.
|
|
|
|
|
Hey guys i am hoping you guys can help, i have been working on this project with i thought would be very simple, but anyways here is what i got. I have a listbox, text box, add and remove buttons. I type in the text box click add and then the item adds to the list box and then gets save to a text file, what i can't figure out is how to remove the items from the list box. i have done this several times in a windows application but i can't seem to get it to work in a asp.net web app. When i comment out the page load procedure i am then able to remove items from the list box.
here is the code that i have:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
namespace WMS_WebConfig
{
public partial class _Default : System.Web.UI.Page
{
private StreamWriter writer;
private StreamReader reader;
int index;
protected void Page_Load(object sender, EventArgs e)
{
monitoredSitesLB.Items.Clear();
if (!Directory.Exists("C:\\Program Files\\Virasec, LLC\\WMS"))
{
Directory.CreateDirectory("C:\\Program Files\\Virasec, LLC\\WMS");
}
if (!File.Exists("C:\\Program Files\\Virasec, LLC\\WMS\\monitoredsites.txt"))
{
writer = new StreamWriter("C:\\Program Files\\Virasec, LLC\\WMS\\monitoredsites.txt", true);
writer.Close();
}
reader = new StreamReader("C:\\Program Files\\Virasec, LLC\\WMS\\monitoredsites.txt");
string line;
while ((line = reader.ReadLine()) != null)
{
monitoredSitesLB.Items.Add(line);
}
index = monitoredSitesLB.SelectedIndex;
reader.Close();
}
protected void addBtn_Click(object sender, EventArgs e)
{
ListItem item = new ListItem(urlTxtBox.Text);
if (monitoredSitesLB.Items.Contains(item))
{
statusLbl.Text = "The website you entered is currently being monitored. " +
"Please enter another site to monitor.";
}
else
{
if (urlTxtBox.Text.Contains("http://"))
{
monitoredSitesLB.Items.Add(urlTxtBox.Text);
writer = new StreamWriter
("C:\\Program Files\\Virasec, LLC\\WMS\\monitoredsites.txt", false);
if (File.Exists("C:\\Program Files\\Virasec, LLC\\WMS\\monitoredsites.txt"))
{
foreach (object li in monitoredSitesLB.Items)
{
writer.WriteLine(li.ToString());
}
writer.Close();
}
}
else
{
urlTxtBox.Text = "http://" + urlTxtBox.Text;
item = new ListItem(urlTxtBox.Text);
if (monitoredSitesLB.Items.Contains(item))
{
statusLbl.Text = "The website you entered is currently being monitored. " +
"Please enter another site to monitor.";
}
else
{
monitoredSitesLB.Items.Add(urlTxtBox.Text);
writer = new StreamWriter
("C:\\Program Files\\Virasec, LLC\\WMS\\monitoredsites.txt", false);
if (File.Exists("C:\\Program Files\\Virasec, LLC\\WMS\\monitoredsites.txt"))
{
foreach (object li in monitoredSitesLB.Items)
{
writer.WriteLine(li.ToString());
}
writer.Close();
}
}
}
}
}
protected void remBtn_Click(object sender, EventArgs e)
{
index = monitoredSitesLB.SelectedIndex;
monitoredSitesLB.Items.RemoveAt(index);
writer = new StreamWriter
("C:\\Program Files\\Virasec, LLC\\WMS\\monitoredsites.txt", false);
if (File.Exists("C:\\Program Files\\Virasec, LLC\\WMS\\monitoredsites.txt"))
{
foreach (object li in monitoredSitesLB.Items)
{
writer.WriteLine(li.ToString());
}
writer.Close();
}
}
protected void monitoredSitesLB_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
|
|
|
|
|
Just wanted to add, Thanks in advance to anyone who may have suggestions
Travis Combs
|
|
|
|
|
You haven't understood the life-cycle of an asp.net page. Every time you click either button a postback occurs and the page is re-loaded, thus re-setting your "index" variable. You should include a
if (!Page.IsPostBack) {...}
block surrounding your Page_Load event code to prevent this happening. The listbox will be populated by the page's ViewState instead and the selected item's index preserved. Google it.
|
|
|
|
|
Web apps are different from win apps
I got confused too when moved from win to web
In the page load, you need to include all that code inside a page.ispostback condition so it will only execute the first time and not when you are adding or removing items
if (!page.ispostback)
{
}
Alexei Rodriguez
|
|
|
|
|
Hi All
I'm currently involved in the design of a college project for this new web based based tool in asp.net that shows and runs processes (defined as flow charts currently). Ideally we'd like to store the steps/processes in form of some XMLs and have a rules engine process the same, and display them as UI elements to guide the user through each step. Are there any existing libraries that can be used as a framework for the same?..We'd like to have the ability to define new processes through configuring new xmls/xslts without any changes to the rules engine.
Any other ideas through which we could implement this are also welcome
Many Thanks
Yogz
|
|
|
|
|
I have a login page
When a user logs in, i add some variables to the session, this has been working fine, but now, i would like to let the user choose the "Remember me" option which will create a persistent cookie
By closing the browser, and reopening i am successfully authenticated, but i also need to initialize the session
Where can i add the logic to initialize the session??
Can i do it in the global.asax?? in wich event?
Or is it the only way to add this logic to a basepage and inherit all pages from this basepage?
Any comments and suggestions will be appreciated
Thanks
Alexei Rodriguez
|
|
|
|
|
My page has a bottom and hidden <div> text area.
inside the div there is a text and link bottom [X]
1) Clicking the bottom:
make the bottom inactive and display the text.
2) Clicking the [X]
hide the <div> and make the bottom active again.
with some help I have done the first step but I can't do the second.
this is the code, if you please help me.
Thanks
<asp:Button ID="btn" runat="server" Text="click me" OnClientClick="return false;" />
<div id="help" class="panel" style="display:none;">
<asp:LinkButton ID="btnClose" runat="server" OnClientClick="return false;" Style="background-color: Red;
color: #FFFFFF; float:right; text-align: center; font-weight: bold; text-decoration: none;
border: outset thin #FFFFFF; padding: 5px;" Text="X" ToolTip="Close">
</asp:LinkButton>
This is my panel This is my panel This is my panel This is my panel This is my panel
</div>
<cc1:AnimationExtender ID="AnimationExtender1" runat="server" TargetControlID="btn">
<Animations>
<OnClick >
<Sequence>
<EnableAction Enabled="false" />
<Parallel AnimationTarget="help" Duration=".3" Fps="25">
<StyleAction AnimationTarget="help" Attribute="display" Value="block"/>
<Move Horizontal="150px" Vertical="200px" />
<Color AnimationTarget="help" PropertyKey="backgroundColor"
StartValue="#AAAAAA" EndValue="#FFFFFF" />
</Parallel>
</Sequence>
</OnClick>
</Animations>
</cc1:AnimationExtender>
<cc1:AnimationExtender ID="AnimationExtender2" runat="server" TargetControlID="btnClose">
<Animations>
<OnClick>
<Sequence>
<StyleAction AnimationTarget="help" Attribute="hidden" Value="block"/>
</Sequence>
</OnClick>
</Animations>
</cc1:AnimationExtender>
|
|
|
|
|
Can someone please tell me how do I display a label before a Multiline Text Box to appear alligned with the top edge of the text box instead of it's bottom edge!
Thanks
Tina
|
|
|
|
|
If you have them in some kind of container control (e.g HTML table), you should be able to set the vertical alignment CSS property. That way, if the table cell has the same height as the multi-line text box, you can set vertical-align on the label's cell to be the top of the cell. This will make it appear that the label's top border is on the same line as the multi-line text box's top border.
Hope that helps.
Have faith in yourself; amateurs built the Ark, professionals built the Titanic.
|
|
|
|
|
Thanks alot, I tried the exact same thing right after posting this and it worked...instead of table, I used a span though and was able to set the v-align under style on that. Thanks for the response.
Tina
|
|
|
|
|
I've a webservice, My client want to access this webservice, using this service he has to send messages. But here problem is he is not able to access the service. My webservice is based on HTTPS.
But we created one windows service to send data, we don't face any problem while sending data to webservice, but our client not able to send data to my webservice.
What are issues behind this.If anybidy know the solution, Please let me know.
Thanks in advance.
|
|
|
|
|
this is the code :
<code><columns>
<asp:commandfield showselectbutton="True" showeditbutton="True" xmlns:asp="#unknown" />
<asp:boundfield datafield="Name" headertext="Name" sortexpression="[Name]" xmlns:asp="#unknown" />
<asp:boundfield datafield="Description" headertext="Description" sortexpression="" xmlns:asp="#unknown" />
<asp:boundfield datafield="Price" headertext="Price" sortexpression="[Price]" xmlns:asp="#unknown" />
<asp:boundfield datafield="Rating" headertext="Rating" sortexpression="[Rating]" xmlns:asp="#unknown" /><asp:checkboxfield datafield="IsSubsciption" headertext="Is Subsciption" xmlns:asp="#unknown"> SortExpression="[IsSubsciption]" />
<asp:hyperlinkfield navigateurl="<b">"CrossSellEdit.aspx?id=<%#Eval("Id") %>" Text="Attach Products" /></asp:hyperlinkfield>
</asp:checkboxfield></columns></code>
this is the error details :
Parser Error
<b>Description</b>: 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.
<b>Parser Error Message</b>: Literal content ('<asp:HyperLinkField NavigateUrl="CrossSellEdit.aspx?id=+') is not allowed within a 'System.Web.UI.WebControls.<big>DataControlFieldCollection</big>'.
<pre>
Line 26:<asp:checkboxfield datafield="IsSubsciption" headertext="Is Subsciption" xmlns:asp="#unknown">
Line 27: SortExpression="[IsSubsciption]" />
<b>
Line 28: <asp:hyperlinkfield navigateurl="CrossSellEdit.aspx?id=+<%#Eval("Id") %>" text="Attach Products" /></b>
Line 29:
Line 30: <emptydatatemplate></emptydatatemplate></asp:checkboxfield></pre>
|
|
|
|
|
AT first glance it looks like #Eval("Id") must = + which it obviously doesn't like. Have you tried debugging to see?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Try with comething like tis:
navigateurl='<%# Eval ("Id", "CrossSellEdit.aspx?id={0}") %>'
Alexei Rodriguez
|
|
|
|
|
Are you using a gridview?
If so, I find it much easier to use the onRowDataBound E.G.
OnRowDataBound="GridView1_RowDataBound"
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
// on each row which is DataRow populate dropdown lists
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView drv = (DataRowView)e.Row.DataItem; //For datatable it is dbdatarecord if datareader
HyperLink hl = (HyperLink)e.Row.FindControl("HyperLinkId");
hl.NavigateURL = "CrossSellEdit.aspx?id=" + drv["id"].ToString();
}
}
I didn't get any requirements for the signature
|
|
|
|
|
Hi,
I am new to regex, i want write regex for number that accept
between 1 and 999,999,999 value.
cvan you pls send me the regex.
Thanks n advance.
|
|
|
|
|
People aren't going to do your job for you.
You have to at least make an attempt. Post some code if you get stuck...
I didn't get any requirements for the signature
|
|
|
|
|
Try Google, there are lots of good regex tutorials.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
|
Background: I built a really cool chat that just uses ajax and asp.net pages. Its even event based. I had to build it because nothing else out there does what I want.
Problem: I have to store the chat messages and some other things as global variables in the application variable. Like List<chatmessage> msgList.
But I get invalid cast exceptions when I try to initialize a local variable of the same type. Its because its not thread safe. So, from different threads List<ChatMessage> isn't the same type.
my only other solution is to create a separate list for each property of ChatMessage. like List<string> msgList_msg; List<string> msgList_is_blocked, List<string> msgList_date, List<string> msgList_userId.
I don't want to do that but I don't feel like I have a choice.
Any Ideas or Suggestions?
|
|
|
|
|
hy ...
The query iz how can i read the contents of a MSword file
on a static web page...using asp.net c#
I used filestream for this purpose as it accepts both synchronous and asynchronous file reading but failed to open the word page on web page..
plz help me out
|
|
|
|
|
anyone please help me
I am designing program in which the program has to convert a pay slip generated (programatically) to .pdf . The thing is the data required for the form is taken from database and is captured in a PAY SLIP format(.aspx) , which is then convertd (the pay slip generated) to .PDF
My questions are
how to capture the screen (.aspx), containing the payslip generated , and convert into the .pdf ?
can .aspx screenshot be converted to .pdf (pay slip) ?If no how do I convert the .aspx to .html (with the captured data from dtabase) , such that I can convert .html to .pdf (I have a third party software to convert .html to .pdf)
may please help me
any mistakes above may please excuse me
Thanks in Advance
Kovuru Sreedhar
|
|
|
|
|
there are some examples of this being done but I dont know any good ones to recommend. Check this thread out though it appears to be discussing your problem
Convert to .pdf
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
Hi All,
I have created a XML Web Service with ASP.NET 2.0 . it is working fine with the client application in my local machine,but when i uploaded to the server which is having asp.net 2.0 framework,webmethod return an error called
"Method SessionCreate can not be reflected"
I am unable to find this issue since it is working fine in my computer(which is also having asp.net 2.0)
can any one help me to solve the issue?
Thanks in Advance.......
|
|
|
|