|
I have an application that retreives records from a database, which will be displayed in a datagridview. Moreover, I would also generate a csv file from that query and allow user to save it. I have a code that save a csv file but I don`t have a code on how to generate a csv from database records. How will I do that? Is any body here who can help me. Much appreciated if somebody will give me a link or code.
Thanks in advance,
C#Coudou;)
******************************
I just want to
know everything
|
|
|
|
|
can u give the DataBase table structure ?
Ramana
|
|
|
|
|
Hi,
I developed one user control which contain 3 check boxes. Now Checkbox3 is enabled only Checkbo1 and 2 are checked. I want to enable the Checkbox3 by using the JavaScript by checking whether checkbo1 and 2 checked or not.
Can anyone help me on this.
Thanks in advance
|
|
|
|
|
This is javascrpt 101, the main thing is you need to write script that creates variables that contain the client side names of the checkboxes.
What else do you need help with ?
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 all,
Pls does anyone here have an idea how I can reduce the default session timeout in my web application? (I am using dotnetnuke)
Thanks!
|
|
|
|
|
In web.config
<system.web>
<sessionState timeout="30"/>
</system.web>
Ranjith Stephen
|
|
|
|
|
|
I just need ASP registration page with MS Access database and dsn file
but put the mdb file in folder name data
thanks for all
bbbbginer
|
|
|
|
|
Read "How to get an answer to your question"
only two letters away from being an asset
|
|
|
|
|
You probably would have to modify connection string, to point it to mdb file.
|
|
|
|
|
Hi,
I have an array like this:
string[3] arr;
arr[0]="ck1";
arr[1]="ck2";, arr[2]= "ck3"..
Now In my aspx page I have 3 checkboxes. Now I want to set the Checkbox text from the array arr values (for the first checbox text as arr[0]. like this) instead of setting the text while declaring the checkboxes.
Thanks in advance.
|
|
|
|
|
there is a read/write property "Text" for checkbox. So what is the problem is setting the text ?
You can set it like
checkbox1.Text = arr[0].ToString()
Ranjith Stephen
|
|
|
|
|
When creating custom control, does it need to be in diffrent project as ddl?
If no then how can i use custom control (Class of custom control is in App_Code folder), within same project.
|
|
|
|
|
//Hi I am new for Asp.net
// try this
//give a namespace(Ex:ExtendedCalendrControl) for your control(ex:ViewCalender class) in the App_Code folder
namespace ExtendedCalendrControl
{
public class ViewCalender : System.Web.UI.WebControls.Calendar
{
//code
}
}
//register the namespace
<%@ Register Namespace="ExtendedCalendrControl" TagPrefix="viewCal" %>
<viewcal:viewcalender id="viewCalnder" selectionmode="None" width="400">
ramana
|
|
|
|
|
I have already tryied this.
I coudnt Register, Even if i used src. I wanted to use class.cs not class.aspx. If i woud link aspx, it probably would work, but i want class.cs
|
|
|
|
|
I can't seem to get to display the results from a gridview. The code compiles but it only shows 'no records' when I display the webpage. Any help would be greatly appreciated. I am thinking that maybe the information for 'typename' and 'dataojecttypename' are incorrect. What exactly should these two contain?
Here is my code in part:
[DataObjectMethod(DataObjectMethodType.Select)]
public static List<userdata> getAllUsers()
{
MySqlCommand cmd = new MySqlCommand();
DB_Connection conn = new DB_Connection();
try
{
cmd.Connection = (MySqlConnection)conn.DBConnect();
cmd.CommandText = "getAllUsers";
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteNonQuery();
MySqlDataReader dr;
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
List<userdata> userList = new List<userdata>();
while (dr.Read())
{
UserData user = new UserData();
user.UserID = Convert.ToString(dr["User_ID"]);
user.UserLastName = Convert.ToString(dr["User_Last_Name"]);
user.UserFirstName = Convert.ToString(dr["User_First_Name"]);
}
dr.Close();
return userList;
<asp:objectdatasource id="ObData" runat="server" typename="users"
="" oldvaluesparameterformatstring="original_{0}" selectmethod="getAllUsers" dataobjecttypename="userdata">
<asp:gridview id="GridView1" action="databind" runat="server" datasourceid="ObData" autogeneratecolumns="False" emptydatatext="<b>No Records</b>" allowpaging="True" datekeynames="User_Id">
<columns><asp:boundfield datafield="User_Id" headertext="User_Id" sortexpression="User_Id">
<asp:boundfield datafield="User_Last_Name" headertext="LastName" sortexpression="User_Last_Name">
<asp:boundfield datafield="User_First_Name" headertext="FirstName" sortexpression="User_First_Name">
|
|
|
|
|
Your method returns userList, which has only been instantiated and has not been initialized. You might want to put some values in that list for the datagrid to bind to. I'm assuming thats what you're binding the datagrid with.
Next time, please put the code in <pre></pre> tags to make it easier to read.
|
|
|
|
|
|
List userList = new List();
You create an instance of a List object but you don't add any items to it.
while (dr.Read())
{
UserData user = new UserData();
user.UserID = Convert.ToString(dr["User_ID"]);
user.UserLastName = Convert.ToString(dr["User_Last_Name"]);
user.UserFirstName = Convert.ToString(dr["User_First_Name"]);
}
For each iteration of the loop, you create a new UserData object and populate it with data from the current record returned by the DataReader. However you don't do anything with each UserData object. After each iteration of the loop the UserData object will go out of scope and be lost. You should add these objects to some sort of collection data structure if you want to retain them.
Regards
Paul
|
|
|
|
|
Thanks, Paul. You pointing this out made me realize that I had forgotten a very important line of code, mainly: userlist.add(user);
It is working like a charm now.
|
|
|
|
|
I am developing an home page which can be access from 5 countries. Based on user location (which i don't know it could be Country A, B, C , D or E) i need to change home page accordingly. By default we will have country A.
My boss says try to explore culture...but i have no idea for the same...Could you please show some directon....
Thanks
Thanks
|
|
|
|
|
You can create a CultureInfo object from a culture identifier or culture name. Example:
CultureInfo culture = new CultureInfo("en-GB");
You just have to find out what culture the user preferres. The Accept-Language header in the HTTP headers might be one way to find this out.
You use the CultureInfo object whenever you format any data that is culture dependant, for example in the string.Format or double.ToString methods. Example:
labelPrice.Text = price.ToString("C2", culture);
---
single minded; short sighted; long gone;
|
|
|
|
|
I am using this
Response.Write(CultureInfo.CurrentCulture.ThreeLetterISOLanguageName);
and everytime is shows USA....I tried to change the settings from control panel-->regional and language options....
But no luck!!
thanks
|
|
|
|
|
Amit Kumar G wrote: I am using this
Response.Write(CultureInfo.CurrentCulture.ThreeLetterISOLanguageName);
and everytime is shows USA...
Yes, of course. You are showing the culture that the server is using.
---
single minded; short sighted; long gone;
|
|
|
|
|
Check the dataset that is returned from from the fill method
"Session("Formats") = dsFormat"
Don't store your dataset in a session variable, it is bad practice and a performance drain.
"selectText = "select format from Formats where fID='" + num + "' and format <> 'Other'"
Don't use in-line sql. Use stored procs, or at least parameterized commands.
And don't hard code the connection string, even if it is a test app, get in the habit of using good programming practices.
only two letters away from being an asset
|
|
|
|