|
When you ask about divs, you're asking about HTML. ASP.NET is therefore irrelevant. The answer is that you can break stuff up on a page many ways, but if you want multiple forms on a page ( aspx files ), you can't do it. You can create as many pages as you like as controls ( ascx files ) and put as many of those on a page as you like.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanks!! I understand Div are part of HTML. Ok let me put my question in this way...I have three forms say a.aspx,b.aspx, c.aspx and i want to display all them in one go in browser.
All three forms are having their own controls and buttons which will do different action. So user can submit relevant form back to server.
Any views?
|
|
|
|
|
Hi
my gridview is below:
<asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
CellPadding="0" EmptyDataText="-- Kayıt Yok --" GridLines="Horizontal" Width="100%">
<RowStyle CssClass="TDS" />
<AlternatingRowStyle CssClass="TDS" BackColor="#F7F6F3" />
<Columns>
<asp:BoundField DataField="title" HeaderText="Kongre Adı">
<HeaderStyle CssClass="TDColoredHeader" HorizontalAlign="Left" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField HeaderImageUrl="~/images/seperator.gif">
<ItemStyle Width="2px" />
<HeaderStyle CssClass="TDColoredHeader" />
</asp:BoundField>
<asp:TemplateField HeaderText="Sil">
<ItemTemplate>
<asp:TextBox runat="server" CssClass="Textbox" ID="Textbox1" Text=""
MaxLength="200" Width="100%"></asp:TextBox>
</ItemTemplate>
<ItemStyle Width="200px" />
<HeaderStyle CssClass="TDColoredHeader" HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:TemplateField>
</Columns>
</asp:GridView>
When i run the project, i cannot see the Textbox on the page. What's my mistake?
If i don't add a server-side control, it works. But i have to add a server-side control.
ozgur.nevres
|
|
|
|
|
Hi.....
One of the my webform contain some dropdownlist and
text box (multiline).Suppose there is a data entry operator
filling any employee information while filling information he
can't remember some information about employee and he fill
some information in textbox and select some value ifrom dropdown
list and then he goes to other 2-3 different form and read the
information that he need and come back to origenal
page where he filling the information.When he come then all
the information that he fill before going to other page should
be remain as it before.
How can i do this? i am tying session but session hav a limit to
store data in it and the operator can fill a large amount of data.
how can i do this?Is there any other way?
df
|
|
|
|
|
Don't know if this will help but why don't you append the operators text in a string builder and set the Session equal to the string builder. Its only one object... so when u read from the session cast the session data to a string builder and read from it.
|
|
|
|
|
Hi MaYo69
but we know session have a limit to store the value in it.
If the user write a more data in text box that could exceed
session limit then in that case we having some error or we
got nothing?Any other option that that?
Do u know HashTable can store the values in it when user navigate
from one page to different like session store the value.
df
|
|
|
|
|
Hi,
I'm not too sure about HashTable. Only thing I used so far is Session, but it's probably cause I never reached the Session limit.
Soz I couldnt help
|
|
|
|
|
Hi
You have to maintain state of page because web applications are stateless. So i would suggest store the info in SQL or any other database before leaving the page. Other way could be viewstate. But you need to take care that view state can slow down the application or site.
I hope this helps you.
Amit
|
|
|
|
|
Hi Amit,
Do you know any other option than that?Can we do it using javascript?
df
|
|
|
|
|
You have to choose from cookies, sessions, viewstate, out proc (SQL), Query string. So i will go for SQL....Long way is also there throgh Java Script ie. Callbacks (behind the scene)...
|
|
|
|
|
hello everyone,
i have a small doubt regarding the validation.I have a textbox in an .aspx form i want to write a validation through C# code such that the textbox should accept only integers but not using validation controls.Plz hellp me in solving this problem
regards,
murali
murali
|
|
|
|
|
Go for java script.
function IsNumeric(sText)
{
var ValidChars = "0123456789";
var IsNumber=true;
var Char;
var NumberofDots=0;
for (i = 0; i < sText.length && IsNumber == true; i++)
{
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1)
{
IsNumber = false;
}
} // end of for loop
return IsNumber;
} // End of IsNumeric function
Amit
|
|
|
|
|
|
Hi Forum,
I am having some really iritating problems with an simple input page which should pass parameters into a stored procedure from the text boxes first and last name.
I keep getting the error during exection of sp_myinsert, pfirstname not defined, every time i try to submit the form
Has anyone got any suggestions I have giving my code for procedure and page
many thanks
boy
--------------------------------
CREATE DEFINER=``@`localhost` PROCEDURE `sp_myInsert`(pFirstName varchar(20), pLastName varchar(30))
BEGIN
INSERT INTO Names (FirstName, LastName) values (pFirstName, pLastName);
END
-------------------------------------------
<%@ Page Language="VB" debug="true" %>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace = "MySql.Data.MySqlClient" %>
<script language="VB" runat="server">
Sub page_load()
End Sub
''' <summary>
''' Page_load
''' Recognised by ASP and must be provided on loading of page.
'''
''' Creates connection to database, passes stored procedure into test database
''' and fills a table, which is showing in web browser
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Sub sendData(ByVal sender As Object, ByVal e As EventArgs)
Dim litErr As New LiteralControl
'Create connection string to pass database, string holds login information to mySQL,
Dim connectionString As String
connectionString = "Server=; uid=; pwd=;database=test;"
'Builds .net mysql connection and passes connection string into method
Dim connection As New MySqlConnection(connectionString)
'Open connection to DB
connection.Open()
'Create mySql command string for passing query or SPROC(Stored Procedure)
Dim cmdString As New MySqlCommand
'Set Command to equal mySql connection,t so can pass SQL query
cmdString.Connection = connection
Try
'Set command string to equal SPROC
cmdString.CommandText = "sp_myinsert"
'ONLY PLACE THIS IF SPROC, sets the command to a SPROC
cmdString.CommandType = CommandType.StoredProcedure
Dim param As New MySqlParameter
param = cmdString.Parameters.Add("p_firstname", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = txtFirstName.Text
param = cmdString.Parameters.Add("p_lastname", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = txtLastName.Text
cmdString.ExecuteNonQuery()
connection.Close()
Catch ex As Exception
litErr.Text = ex.Message
MsgBox(ex.Message)
End Try
End Sub
</script>
<!DOCTYPE html PUBLIC
<head id="Head1" runat="server">
<title>Untitled Page</title>
<script language="vbscript" type="text/vbscript">
</script>
</head>
<body>
<form id="form1" runat="server">
ENTER FIRSTNAME<asp:TextBox runat="server" ID="txtFirstName">
</asp:TextBox><br /><br />
ENTER LAST NAME
<asp:TextBox runat="server" ID="txtLastName"></asp:TextBox>
<asp:Button runat="server" ID="submit" Text="Submit" onclick="sendData" />
</form>
</body>
</html>
|
|
|
|
|
Hi all,
I want to export reports in my database to snapshot viewer files.
Access.ApplicationClass app = new Access.ApplicationClass();<br />
app.AutomationSecurity = 1;<br />
app.OpenCurrentDatabase( "c:\\data\\Copy of ITS2005.mdb", false, "" );<br />
app.DoCmd.OutputTo( Access.AcOutputObjectType.acOutputReport, "Licenced Fabricators", "Snapshot Format (*.snp)", "c:\\OMFS.snp", Type.Missing, Type.Missing, Type.Missing);<br />
app.DoCmd.Quit( Access.AcQuitOption.acQuitSaveNone );
This works perfectally fine in a windows form but the OpenCurrentDatabase just doesnt want to finish executing in ASP.NET Page.
Any help would be appreciated!
André.
|
|
|
|
|
sorry but i dnt know if my answer will help u by any way or not. but i done xls report of database in my site. here is what i done earlier . there are two ways..
(but at final i used dataset and manually write .. to Responce. which is working fine and is Live)-----
#region old code
//Response.Clear();
//Response.Buffer= true;
//Response.ContentType ="application/vnd.ms-excel";
//Response.Charset = "";
//this.EnableViewState = false;
//System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
//System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
//this.ClearControls(Dgreport);
//Dgreport.RenderControl(oHtmlTextWriter);
//Response.Write(oStringWriter.ToString());
//Response.End();
#endregion
----------------------------------------------------
//try
//{
#region old code diff way
/*DataSet tempds2=new DataSet();
tempds2=getReportData();
if(!(tempds2.Tables[0].Rows.Count<=0))
{
string fileName = "Report.xls";
string FullPath = Server.MapPath("\\")+fileName;
tempds2.WriteXml(FullPath,XmlWriteMode.WriteSchema );
FileInfo file=new FileInfo(FullPath);
if(file.Exists)
{
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/vnd.ms-excel";//"application/octet-stream";
Response.WriteFile(file.FullName);
}
}*/
#endregion
pallavi
|
|
|
|
|
Thanx for the reply,
Some questions, what exactly does this getReportData() method do and is it a custom method??
If your solution worked for u, can u perhaps supply he with a solution or code file plz?
Otherwise dont you know of another way to export reports
|
|
|
|
|
ya both the methods i given worked for me. the getReportData() is custom function wich return me dataset. and first method is useful if u want to export data u are seeing in datagrid (paging =true). but i moved to second because i wanted to export the whole dataset to xls not the page in datagrid.
the third method i am using is not logical but works perfect for my clients requirement. take the data from database in dataset and simple generate the xls using . on 'export to excel' button click with javascript i open blank web form where on page load i write following code. u can pass dataset to this page or get datadet on this pageload.
i hope u will get the useful from below--
Response.Clear();
Response.Buffer= true;
StringBuilder responce_=new StringBuilder();
StringBuilder header=new StringBuilder();
header.Append(""+
"");
header.Append("");
header.Append("");
header.Append("");
header.Append("");
header.Append("");
header.Append("");
header.Append("");
header.Append("");
header.Append("");
header.Append("");
header.Append("");
if(!(tempds2.Tables[0].Rows.Count<=0))
{
for(int i=0;i<tempds2.tables[0].rows.count;i++)
{
responce_.append("<tr>");
for(int j=0;j<tempds2.tables[0].columns.count-1;j++)
{
if(j==0 )
{
responce_.append("<td="" width="70" align="center">"+tempds2.Tables[0].Rows[i].ItemArray[j].ToString()+"");
}
else if(j==1 || j==2 )
{
responce_.Append("");
}
else if(j==3)
{
responce_.Append("");
}
else
{
responce_.Append("");
}
}
responce_.Append("");
}
}
responce_.Append("");
responce_.Append(""+
""+
" | | | | "+
" | | | | " +
"Customer Details Report "+ " | Customer ID | Customer Name | Address | City | Country | Phone Number | Mobile Number | Fax Number | Email | Entry Date | "+tempds2.Tables[0].Rows[i].ItemArray[j].ToString()+" | "+tempds2.Tables[0].Rows[i].ItemArray[j].ToString()+" | "+tempds2.Tables[0].Rows[i].ItemArray[j].ToString()+" | " +tempds2.Tables[0].Rows.Count+ " Records Found. "+ " | ");
Response.ContentType = "application/vnd.ms-excel";
Response.Write(header.ToString()+responce_.ToString());
Response.Charset="";
Response.End();
dnt forget to write last statement.
---
-- modified at 7:55 Wednesday 27th June, 2007
pallavi
|
|
|
|
|
Hi,
Thanks alot for your reply, this seems to be exactly what I am looking for!! I also think the second method is whit seems to be appropriate in this situation.
|
|
|
|
|
welcome..
pallavi
|
|
|
|
|
Hi,
Soz to bother u again but you never told me what it is the getReportData does. I assume it gets the report using OLE, but how does one do that????
|
|
|
|
|
I want to enter data for the txtbox where it has to check some conditions like the first character. I had written the following code, but it is not working, can anyone tell what is the error?
If (Mid(Txtpno.Text, 1,1) <> "P") Or (Mid(Txtpno.Text, 1, 3) <> "oth" Or (Mid(Txtpno.Text, 1, 2) <> "PT") Or (Mid(Txtpno.Text, 1, 2) <> "st") Or (Mid(Txtpno.Text, 1, 2) <> "ac") Or (Mid(Txtpno.Text, 1, 2) <> "vl") Or (Mid(Txtpno.Text, 1, 2) <> "aP") Or (Mid(Txtpno.Text, 1, 2) <> "Tc")) Then
Lblmsg.Visible = True
Lblmsg.ForeColor = Drawing.Color.Red
Lblmsg.Text = "Invalid Pno!"
Exit Sub
End If
|
|
|
|
|
Hi
Firstly i would recommend moving the logic out of the form and into a class which could be used thoughout your application ensuring that the same business rule is followed consistently.
For readability i would also suggest working through as single rules which would then ensure that less processing would take place as the whole statement need not be parsed and the function would return as soon as an invalid pNo rule was reached.
Public Function ValidatePNo(ByVal pNo as string) as boolean
If pNo.startswith("p") then return false
if pNo.startswith("oth") then return false
..
Return True
End Function
|
|
|
|
|
Thank you. It is working.
Chaitra N
|
|
|
|
|
You've used "<>" together with "or". Be very careful.
Consider the following:
If (Mid(Txtpno.Text, 1,1) <> "P") or (Mid(Txtpno.Text, 1,1) <> "F") then
end if
What you're actually saying is that if the first letter doesn't equal P or the first letter doesn't equal F then do something.
What fulfills the criteria of not having a first letter equal to P or not having a first letter equal to F? Absolutely everything is the answer.
If you're trying to do what I think you're trying to do, then you want to use 'and' operators instead of 'or'. It is however exceedingly messy and confusing and you'd be much better off abstracting it into a separate function that checks validity against each parameter one by one.
|
|
|
|