|
Oops forgot to do a DataBind to the grid...
End If
GridView1.DataBind()
End Sub
All fixed, except for the DataFormatString
|
|
|
|
|
From the MSDN BoundField.DataFormatString documentation[^]:
The formatting string can be any literal string and usually includes a placeholder for the field's value. For example, in the formatting string "Item Value: {0}", the field's value is substituted for the {0} placeholder when the string is displayed in the BoundField object. The rest of the formatting string is displayed as literal text.
The placeholder consists of two parts, separated by a colon and wrapped in braces, in the form {A : Bxx}. The value before the colon (A in the general example) specifies the field value's index in a zero-based list of parameters.
You can use {0:C} as a format string for currency values. Take note also of the information provided in the documentation on HTMLEncode . You may need to set this to false .
|
|
|
|
|
in my site i have form to upload image
this image may be very big or very small
but
after user upload this image i want make some imagte prossessing as
(
1- i want to make two image from the original image
2- the first image have (50*50) cordinate
3- the secode image have (200*200) as max hight and max wiedth
4-i want for each image to take new name
)
u can see example in this site
http://www.blocket.se/vi/7874861.htm?ca=10_s
u can see tow image one small and one big
how can do as this in my site
Palestine
|
|
|
|
|
I'm having a problem saving an uploaded file onto the server
Here's the code..am I missing something?
//Button Upload that uploads the file on the server using a Field Input HTML //Control
private void btnUpload_Click(object sender, System.EventArgs e)
{
string strFilename=file1.PostedFile.FileName;
strFilename=System.IO.Path.GetFileName(strFilename);
file1.PostedFile.SaveAs(Request.MapPath(Request.ApplicationPath)+"\\"+strFilename);
}
-----------------------------------------------------------------------------
//I added method="post" and enctype"multipart/form-data"
//but still the button never goes to the server U dunno why??
HTML
---------
----------------------------------------------------------------------------------------------------------
|
|
|
|
|
I am currently looking at re-writing an existing ASP Classic app in ASP.NET 2.0. I am trying to determine the best way to keep a user's profile info available from page to page since most every page in the app requires at least a userid to tie back to the data while the user is logged in. In ASP Classic, I use a Session variable to store the user's record id so that it is available from page to page. However, in ASP.NET I am looking at creating a class for the user with one of the properties being the userid.
How is the best way to allow each page to have access to this class? Some ideas were:
1. Store the UserProfile class into a Session variable and retrieve it as needed.
2. Use a Base class that each page inherits from. Store just the userid in a session variable and have the base class build the UserProfile each time the page is rendered
Is there a better method already in ASP.NET?
Any code examples?
|
|
|
|
|
I want to use a single class to generate DataTables, DataSets, and other objects but I know from experience if I 'Public Share' a variable it is maintained on the server and exposed to ALL users (i.e. Public Share varUserName = 'Mary Sue'... all users see 'Mary Sue' where the variable is written to the page).
Since I'm wanting to use a function and simply return a value/object are there any concerns regarding the scope (lifetime) of the function when multiple users are accessing the same function?
Here's the scenario...
Public Shared Function getUsers(ByVal strFitler as String) as DataTable
Dim dt As New DataTable
'create table and fill...
Return dt
End Function
User_A clicks a button which fires the Public Shared Function getUserInfo() and returns a DataTable which is then used to populate a DataGrid. At the same time User_B clicks the same button. Now for the twist. Lets say User_A applied a filter to view only active users whereas User_B wanted only users with the last name 'Smith'. Since the data being returned is different will both users see the same dataset or given that the requests are probaly not process at the exact same millisecond, will the scope of the function be only during each individual request, thus returning the desired data?
If more clarification is needed I'd be happy to provide. I just want to be sure before I implement.
Thanks in advance,
Chris
|
|
|
|
|
Since you are not declaring the variable dt as static (Shared in VB), it's not shared by the threads. It's allocated on the stack for each call to the method, so it's local to each call, and thus local to each thread.
---
b { font-weight: normal; }
|
|
|
|
|
I use AJAX in ASP.NET, in the client side code, I create a XmlHttpRequest to get data from Server(database). But when server response, how to get data from responseText or responseXML to fill in DataList or DataGrid(because DataList or DataGrid is control that run at server).
Thanks!
|
|
|
|
|
tell me the difference btn asp and asp.net
venugopal
|
|
|
|
|
Venugopal,
Is that an order or a misworded request?
Answer:
private string typeResponse(string question)
{
If(question==order)
{
response="NO!"
}
else
{
response="A LOT!"
}
return response;
}
<--Hehe! Im such a nerd!
|
|
|
|
|
One has a ".net" at the end of it?
Seriously, try Google for "what is the difference between asp and asp.net" You'll find more descriptions on that question than you ever needed.
|
|
|
|
|
|
Hello,
I am new to ASP.net 2.0. I have successfully bound a in-memory DataTable (not connected with a database) with GridView . I have set AutoGenerateEditButton property to true . Now whenever i click on Edit link, the page does postback, but the row does not become editable. I have also tried
GridView1.Rows[e.NewEditIndex].RowState = DataControlRowState.Edit;
in RowEditing event handler. Am I missing something?
Thanks in advance.
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
Try setting GridView1.EditIndex property to e.NewEditIndex in the RowEditing event. Typically this assignment is made automatically, but maybe you have to explicitly set it given the data source you're using? (I'm making a guess on that)
|
|
|
|
|
http://gridviewguy.com/Articles.aspx?articleCategoryID=7
|
|
|
|
|
Dear Friends,
I need to submit a request from a client which will be save in my MS Access database by asp.net. can some one please give me the sample code to submit a request form by asp.net.
Your quick response will be highly appreciated.
Thanks
Murtuza Patel
|
|
|
|
|
|
What I need is a simple way to add a new record to my database based on the data collected in my web site.
I have create an aspx form (vwd express) with several text boxes and a button.
I'd like that clicking the button will create a new record in my database (mdb) wit h the text entered in the texts box as the new record fields values.
|
|
|
|
|
Lots of things you could do. You could:
- use an AccessDataSource control on your page, including an InsertCommand, establishing ControlParameters tied to your text boxes; then code the button to execute the AccessDataSource control's .Insert() method...
- create a custom class that handles your data access; in it, create an .Insert() method of your own that accepts two parameters; use OleDbConnection, OleDbCommand, and OleDbParameter classes to issue the SQL INSERT statement to your database; then code the button to execute the .Insert() method in your custom class...
- create the custom class as before, then use an ObjectDataSource on your page with the associated class. In your button's code, execute the .Insert() method on the ObjectDataSource...
- create a custom class and ObjectDataSource as before, and substitute for your existing textboxes/button a FormView or DetailsView control. Associate the FormView/DetailsView to your ObjectDataSource through the DataSourceID property, and let it handle all the data access for you...
- for that matter, you could associate an AccessDataSource to a FormView or DetailsView as well, and not use a custom class (or coding at all)...
But it sounds like you're very new to this. I'd recommend you go through the QuickStart Tutorials on http://www.asp.net[^] in depth. You'll get to some good exercises on data access. Look at the beginner's videos too - http://msdn.microsoft.com/vstudio/express/vwd/learning/default.aspx[^]
|
|
|
|
|
I am a n0ob to web programming
Recently i created my own web control. I want to make it so that i will recieve arguments like
<.uc1:treeFrame ID="TreeFrame1" runat= "server" argument1= "blah1" argument2= "blah2"/> (remove the "." in front of uc1)
contructors? in the treeFrame class?
also..
when i add my own user control to a html page by dragging it onto the designer, it puts this at the top of the html
<%@ Register Src="treeFrame.ascx" TagName="treeFrame" TagPrefix="uc1" %>
what does this do?
thx thx
-- modified at 0:57 Saturday 15th April, 2006
|
|
|
|
|
2hdass wrote: Recently i created my own web control. I want to make it so that i will recieve arguments like
<.uc1:treeFrame ID="TreeFrame1" runat= "server" argument1= "blah1" argument2= "blah2"/>
You'll want to define "argument1" and "argument2" as properties in your user control. Read the MSDN article An Extensive Examination of User Controls[^] by Scott Mitchell for a better understanding and an example.
2hdass wrote: when i add my own user control to a html page by dragging it onto the designer, it puts this at the top of the html
<%@ Register Src="treeFrame.ascx" TagName="treeFrame" TagPrefix="uc1" %>
The designer is simply registering the custom control on the page so it may be referenced in the markup. Look at the MSDN documentation for the @Register Page declaration[^] for a fuller description.
|
|
|
|
|
Has anyone ever created reports dyanmically? We have been looking into sql reporting services but have found that the report layout must be previously defined. We would like a user to choose data through a web interface and then autmatically generate a report using .net. Anyone have any ideas on how this could be done?
|
|
|
|
|
hi,
You want crystal report ????
if u want i have a solution according to your requirment.
jitendra
|
|
|
|
|
Hi,
Ive got several DataLists on a page. Im using a method to fill the DataSet and Bind the data to each datagrid in turn. So im effectively re-using the same data set to get data from the same adapter and from the same table.
The only difference is that each DataList is to be populated based on different queries eg retreiving orders based on their category - food, drink, desserts etc.
The problem is, each time i fill the dataset it just adds the new content to the old, and thus each DataList displays the info obtained from the previous query strings.
Is there anyway to avoid this, or perhaps to flush the DataSet after i fill each DataList?
Thanks
munklefish
|
|
|
|
|
Hi Munklefish
We're gonna have to see some code to determine where it goes wrong.
It sounds more like the data is being added to the lists on top of what is already there.. but as I said - post some code and we'll catch that bug
The code you're looking for to empty a datatable is:
dtMyDataTable.Clear();
More specifically - let's see where you
- fill the datasets/datatables
- add data to the lists
Kind regards - Jakob
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!
10 kinds of people in the world:
- Those who understand binary
- Those who don't
-- modified at 16:56 Friday 14th April, 2006
|
|
|
|