|
thank u gautam .
but i have three different querries in switch case . and i am going to bind to datgrid according to selected criteria.
so, according to u may i hv to make ready different datatables with the different structures? isnt it there any easy way as--
datatable= (datatable)datareader ; (kidding. but i want it as flexivble as dataset).
thank u.
pallavi
|
|
|
|
|
Why don't you want to use the DataAdapter.Fill method? If you want the data in a DataTable you will be doing the same thing as that method does anyway.
---
single minded; short sighted; long gone;
|
|
|
|
|
thank u guffa,
though dataadapter.fill(........) uses datareader behind the scene, as per requirement i have to use datareader in my code.
plz help.
thanks in advance
pallavi
|
|
|
|
|
Pallavi Bhoite wrote: as per requirement i have to use datareader
Ok, then you just have to (more or less) rewrite the Fill method in your own code.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hello,
I have a grid view with one column and populated that with the following code,
GridView1.DataSource = PropList;
GridView1.DataBind();
Where PropList is a List of string .
Now I have added another column in the GridView1 by the following code
BoundField b;
b = new BoundField();
b.HeaderText = "new1";
GridView1.Columns.Add(b);
Now my problem is that if I have another list of string, How i Add that list to the new column.
Please help me in this regards.
Thanks
sunil
|
|
|
|
|
You cannot. You'd need a list of a struct which has two properties, as you can only bind to one source, but you can set the columns to pull data from properties of items in your list.
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 )
|
|
|
|
|
Hi,
Can you please give me sample code for this.
Thanks,
sunil
|
|
|
|
|
Hi All,
Is there any other way except <div>
to place multiple forms in one page. I am doing development in ASP.Net 2.0.
Please suggest and have a nice day!!.
Amit
|
|
|
|
|
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
|
|
|
|