|
Hey Abdul,
Changes done in the client-side using JavaScript will not save it ViewState. To ASP.NET, it doesn't know that you have changed something. To fix this, use a hiddenfield. When you hit the button, get the list of item into the hiddenfield with delimiters. Once the page is back, fill the list with the items with the hiddenfield value.
Only HiddenField can maintain states all the times.
|
|
|
|
|
Thanks, HiddenField do save the status, Its really appreciated.
Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
hello all,
I want to fetch the static text written at html design page and then fetched data be entered into some variable at code-behind.
could anyone know the code to do so?
|
|
|
|
|
You might face problem of having some html into string variable. Please use the class "HttpUtility" and it method/property as required.
Thanks,
Arindam D Tewary
|
|
|
|
|
If content is inside a td/div/span/p then you can give the container control an Id and set its runat="server". At the server side you can access the control text using the InnerText or InnerHTML property.
WWW, WCF, WWF, WPF, WFC .... WTF
|
|
|
|
|
|
I think you have problem for getting server side error when enter html code in textbox.
For the security reason asp.net does not allow this.
But you can enable it by making
<%@ Page validateRequest="false" %>
Mohan
|
|
|
|
|
Hello,
I have a ListView with EditItemTemplate.
The problem is when I edit an Item, the EditItemTemplate showing out,
but the items layout below the EditItemTemplate become weird.
I attach my screenshot and code behind, hope any one can help me.
http://img28.imageshack.us/img28/3550/91358941.jpg[^]
http://img202.imageshack.us/img202/3694/62318841.jpg[^]
<LayoutTemplate>
<table border="0" width="100%" style="background-color: #FFFFFF; border-collapse: collapse;
border-color: #999999; border-style: none; border-width: 1px; font-family: Verdana, Arial, Helvetica, sans-serif;">
<thead>
<tr style="background-color: #E4E4E4; color: #FFFFFF;">
<td align="left" width="55%">
<asp:Label ID="docLabel" runat="server" Font-Size="10" Font-Names="Arial">DOCUMENT</asp:Label>
</td>
<td align="left" width="30%">
<asp:Label ID="Label8" runat="server" Font-Size="10" Font-Names="Arial">LAST UPDATE</asp:Label>
</td>
<td width="15%">
</td>
</tr>
</thead>
<tbody>
<tr id="itemPlaceholder" runat="server" width="100%" />
</tbody>
<tfoot>
<table width="100%">
<tr>
<td align="center" width="100%" style="text-align: center; background-color: #E4E4E4;
font-family: Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
<asp:NumericPagerField />
<asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False"
ShowPreviousPageButton="False" />
</Fields>
</asp:DataPager>
</td>
</tr>
</table>
</tfoot>
</table>
</LayoutTemplate>
<EditItemTemplate>
<table width="100%" border="1" cellspacing="0" cellpadding="0" style="border: thin dotted #FF0000">
<tr>
<td align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<br />
<td align="right">
Name
</td>
<td>
:
</td>
<td align="left">
<asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' Visible="false" />
<asp:TextBox ID="namebox" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
</td>
</tr>
<tr>
<td align="right">
Permission
</td>
<td>
:
</td>
<td>
<br />
<table border="0" cellpadding="0" cellspacing="0" style="width: 68%">
<tr>
<td align="center">
Available Group
</td>
<td>
</td>
<td width="47%" align="center">
Selected Group
</td>
</tr>
<tr>
<td>
<asp:ListBox ID="GroupListBox" runat="server" Width="125px" DataSourceID="SqlDataSource5"
DataTextField="Name" DataValueField="ID" Height="160px"></asp:ListBox>
</td>
<td>
<asp:Button ID="selectAllBtn" runat="server" Text=">>" CommandName="SelectAll" />
<br />
<asp:Button ID="selectBtn" runat="server" Text=" > " CommandName="SelectOne" />
<br />
<br />
<asp:Button ID="deSelectAllBtn" runat="server" Text="<<" CommandName="DeselectAll" />
<br />
<asp:Button ID="deselectBtn" runat="server" Text=" < " CommandName="DeselectOne" />
</td>
<td>
<asp:ListBox ID="selectedGroupListBox" runat="server" Width="125px" DataSourceID="SqlDataSource6"
DataTextField="Name" DataValueField="ID" Height="160px"></asp:ListBox>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="right">
PDF File
</td>
<td>
:
</td>
<td align="left">
<asp:LinkButton ID="pdfFile" runat="server" Text='<%# Bind("pdfPath") %>' />
<cc1:AsyncFileUpload ID="pdfFileUpload1" runat="server"/>
</td>
</tr>
<tr>
<td align="right">
Source File
</td>
<td>
:
</td>
<td align="left">
<asp:LinkButton ID="sourceFile" runat="server" Text='<%# Bind("docPath") %>' />
<cc1:AsyncFileUpload ID="sourceFileUpload1" runat="server" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<asp:Button ID="updateBtn" runat="server" Text="Update" CommandName="Updated" />
<asp:Button ID="CancelBtn" runat="server" Text="Cancel" CommandName="Cancel" />
</td>
</tr>
</table>
</EditItemTemplate>
<ItemTemplate>
<td runat="server" style="">
<table cellpadding="0" cellspacing="0" class="style14">
<tr>
<td>
<img src="images/arrow.gif" style="width: 18px; height: 18px" />
</td>
<td>
<asp:Label ID="subCatID" runat="server" Text='<%# Eval("ID") %>' Visible="False"></asp:Label>
<asp:LinkButton ID="LinkButton3" runat="server" Font-Names="Arial" Font-Size="10pt"
Font-Underline="False" ForeColor="Black" Text='<%# Eval("Name") %>' CommandName="Click"></asp:LinkButton>
</td>
<td width="2px">
</td>
<td align="right">
<asp:ImageButton ID="editSubCatBtn" runat="server" ImageUrl="~/images/pencil_16.png"
title="Edit" CommandName="Edit" Visible='<%# CBOOL(Eval("subCatModifyable")) %>' />
</td>
<td align="right">
<asp:ImageButton ID="delSubCatBtn" runat="server" CommandName="Delete" ImageUrl="~/images/delete_16.png"
title="Delete" Visible='<%# CBOOL(Eval("subCatModifyable")) %>' />
</td>
</tr>
</table>
</td>
</ItemTemplate>
C@lven Yow
modified on Thursday, April 1, 2010 3:47 AM
|
|
|
|
|
My webform has a link to download a sverver file: "http://Server/App/UpLoad/File1.xls".But when I have upload a new file to replace the old file(File1.xls),this link still download the old file.The stanger thing is when I have deleted "File1.xls",it also download the old file(where the old file from ?!).
All of our client machines have this problem,but when used in the Server's browser, it all works well.
Can anyone help me?
Thanks a lot.
Forgive my poor English
|
|
|
|
|
Xiaoming Qian wrote: But when I have upload a new file to replace the old file(File1.xls)
Do you have screen to upload the files? If yes, check whether it is uploading to the right location or probably uploading?
|
|
|
|
|
You can give a try just checking whether you have anything 'hard coded' inside the application code.
Even deleting from source downloads the same file prompts me thinking same.
Thanks,
Arindam D Tewary
modified on Thursday, April 1, 2010 2:53 AM
|
|
|
|
|
.xls file gets cached in the temporary internet file folder, try clearing the client browser cache.
WWW, WCF, WWF, WPF, WFC .... WTF
|
|
|
|
|
Is it possible to use ASP.NET Control in MVC Patterns
|
|
|
|
|
Why not! You can use them... MVC is a pattern..There is a framework too that can be used to build ASP.NET application using it.
For more:http://www.asp.net/mVC/[^]
|
|
|
|
|
Good people,
Hello. Our webservice is not working. We should be receiving information via an HTTP POST. However, nothing is working. Below are the code files. Let me know what you think. Thanks in advance for any help or information you can provide. (By the way, some information (e.g. class names, connection strings, etc...) has been removed or changed in order to hide any sensitive information.
<pre>
Imports System.Web.Mail
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Partial Class hbcertification
Inherits System.Web.UI.Page
Public strBody As String = ""
Public sqlInsertStr As String = ""
Public errStr As String = ""
Public txn_id, first_name, last_name, address_street, address_city, address_state, address_zip, address_country, address_phone, payer_email, Price, key, invoice, payment_date, mc_fee, buyer_ip As String
Dim myConn As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionInfo"))
'*******************************************************************************************
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
strBody += "Test email sent.<br><br>Customer name: " & Request("first_name") & " " & Request("last_name")
strBody += "<br>Reg Key: " & Request("key") & "<br><br>Transaction ID: " & Request("txn_id") & "<br>Tran Type: " & Request("txn_type")
updateFile(Server.MapPath("log.txt"), strBody)
txn_id = Request("txn_id")
first_name = Request("first_name")
last_name = Request("last_name")
address_street = Request("address_street")
address_city = Request("address_city")
address_state = Request("address_state")
address_zip = Request("address_zip")
address_country = Request("address_country")
address_phone = Request("address_phone")
payer_email = Request("payer_email")
Price = Request("Price")
key = Request("key")
invoice = Request("invoice")
payment_date = Request("payment_date")
mc_fee = Request("mc_fee")
buyer_ip = Request("buyer_ip")
If Request("first_name") <> "" And Request("last_name") <> "" Then
SendMail("jamesrobertson@hotmail.com", "feedback@morris.com", strBody, "Software Order Notification", "sales@morris.com")
Else
Response.Write("<br>Email not sent. Name missing.")
End If
Dim sItem As String
Response.Write("<br><hr noshade size=""1"" />")
If Request.Form("dosubmit") = "1" Then
Response.Write("FORM VALS:")
For Each sItem In Request.Form
Response.Write("<br>" & sItem & " - [" & Request.Form(sItem) & "]")
Next
sqlInsertStr += "insert into aspnet_MorrisCustomerInfo (TransactionID,FirstName,LastName,AddressStreet,AddressCity,AddressState,AddressZip,AddressCountry,AddressPhone,PayerEmail,Price,AuthenticationCode,InvoiceID,PurchaseDate,PaypalFee,PurchaseIPAddress) values ('" & SQLSafe(txn_id) & "','" & SQLSafe(first_name) & "','" & SQLSafe(last_name) & "','" & SQLSafe(address_street) & "','" & SQLSafe(address_city) & "','" & SQLSafe(address_state) & "','" & SQLSafe(address_zip) & "','" & SQLSafe(address_country) & "','" & SQLSafe(address_phone) & "','" & SQLSafe(payer_email) & "','" & SQLSafe(Price) & "','" & SQLSafe(key) & "','" & SQLSafe(invoice) & "','" & SQLSafe(payment_date) & "','" & SQLSafe(mc_fee) & "','" & SQLSafe(buyer_ip) & "')"
runMyQuery(sqlInsertStr, False)
End If
Response.Write("<br>sqlInsertStr is: " & sqlInsertStr)
Response.Write("<br><hr noshade size=""1"" />")
End Sub
'*******************************************************************************************
Sub SendMail(ByVal strEmailAddress, ByVal strEmailAddress_cc, ByVal Email_Body, ByVal Email_Subject, ByVal Email_From)
If Request.ServerVariables("server_name") <> "localhost" Then
Try
Dim resumeEmail As New MailMessage
resumeEmail.To = strEmailAddress
resumeEmail.Cc = strEmailAddress_cc
resumeEmail.From = Email_From
resumeEmail.Subject = Email_Subject
resumeEmail.Priority = MailPriority.High
'resumeEmail.BodyFormat = MailFormat.Html
resumeEmail.BodyFormat = MailFormat.Html
resumeEmail.Body = Email_Body
'System.Web.Mail.SmtpMail.SmtpServer = "morris.com"
System.Web.Mail.SmtpMail.SmtpServer = "relay-hosting.secureserver.net"
System.Web.Mail.SmtpMail.Send(resumeEmail)
Response.Write("<br>Email sent.")
Catch exc As Exception
Response.Write("<br><b>MAIL ERROR OCCURRED</b><br><br>" & exc.ToString() & "<br>From: " & Email_From)
End Try
Else
Response.Write("<br><br><b>TEST RESPONSE</b><br><br>" & strBody & "")
End If
End Sub
End Function
End Class
<%@ Page Language="VB" Debug="true" AutoEventWireup="false" CodeFile="hbcertification.aspx.vb" Inherits="hbcertification" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Process Data</title>
</head>
<body>
<form id="form1" runat="server">
<br /><br />
</form>
</body>
</html>
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="ConnectionInfo" value="********************************************************" />
<add key="maintable" value="test123" />
<add key="sitename" value="Hyper - Another Dimension" />
</appSettings>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true" />
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows" />
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
</pre>
-- Modified Thursday, April 1, 2010 7:54 AM
|
|
|
|
|
Can you please post just the webservice implementation instead of all? Right now, i don't see any webservice present... is there any? You need to have WebMethods in order to call webservice methods.
Kindly re-check and update the question with it.
|
|
|
|
|
Thank you so much for replying.
I have cleaned up the code to only include the web service code-behind and related ASP/XML code.
Thanks in advance for any insight you can provide.
|
|
|
|
|
Hello coders,
I have a web service which when called, should take the attachment that it got and use it in the response.
The webservice needs to create a csv file with 2 header values like type,location.
Then beneath that would be different rows which would look like this.
type,location
input,C:\input.csv // (I will be getting this C:\input.csv as an attachment)
output,C:\output.csv
imagepath,C:\
imagename,temp
width,800
height,800
I need to create this csv which i will be using and create an image based on this information.
Later i will need to send out the link of the images and the output file as an attachment.
I have found how to create a csv from the database but how do i hard-code it with the data i want?
So when the webservice is called, it will need to perform this. How can i do this???
Any help is appreciated. Thanks.
|
|
|
|
|
It's just a file, write it.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I have got the csv thing but my problem is mainly with getting the attachment (in the form of C:\output.csv) and after creating the image , i need to send back the image and csv file as attachments.
This webservice would be called and all these functionalities will take place but this service is running only when i press Invoke, how can i avoid this?
|
|
|
|
|
scorpio22 wrote: This webservice would be called and all these functionalities will take place but this service is running only when i press Invoke, how can i avoid this?
If I understand correctly, you want to run the service always right? If that is the case, you cannot do that using a Webservice. Go for Windows Services.
|
|
|
|
|
and how will get the attachments and send the attachments if it is a windows service?
|
|
|
|
|
but my project is actually a web service and not a windows service.
how can i do the attachments thing in a web service?
|
|
|
|
|
|
I have two <asp:buttonfield> in gridview in which i am using one for datakeynames and another for display name. so when i click on name button i want get the text of that button control in gridview_rowcommand
<asp:GridView ID="gvAlRecord" runat="server" AutoGenerateColumns="False"
DataKeyNames="ARGSequenceNumber" Height="200px"
onrowcommand="gvAlRecord_RowCommand" Width="100%"
onrowdatabound="gvAlRecord_RowDataBound"
onrowcreated="gvAlRecord_RowCreated">
<Columns>
<asp:ButtonField ButtonType="Link" CommandName="Sequence_No"
DataTextField="ARGSequenceNumber" HeaderText="Sequence No"
SortExpression="ARGSequenceNumber" />
<asp:ButtonField ButtonType="Link" CommandName="Provider"
DataTextField="ARGProviderName" HeaderText="Provider"
SortExpression="ARGProviderName" />
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#0099FF" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
|
|
|
|
|