|
Hello Friends, I am new to ASP.net.
I want to make an asp.net page (which look like a spreadsheet)wherein, the user enters some data in one or more columns. Clicks the button, & the required result is displayed on another page.
I made a simple editable gridview in asp.net (default.aspx) and put some numeric data & clicked the button.
Now how can I pass the values ( as an array) stored in one or more columns to another page(result.aspx) to carry out further analysis.
I want to call following method to data array(values stored in column of previous page)
public static double Mean(double [] data) //DATA IS THE COLUMN OF GRIDVIEW
{
int n = data.length;
double mean = Sum(data)/n;
return mean;
}
Please Help with Proper Coding for storing GridviewColumn in session & then retrieve it onto another page to call the method above.
PLEASE HELP
|
|
|
|
|
ashutosh_karna wrote: Please Help with Proper Coding for storing GridviewColumn in session & then retrieve it onto another page to call the method above.
You should read the link in my sig.
The most common way to do what you want, is to store the data in a database, and pass an id on the URL to a page that uses that id to read and display the data
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
|
|
|
|
|
(VS 2005)
Is there any way to have 1 column available for editing for all rows at the same time using GridView?
If you know how to do this a code snipet would be appreciated.
Thanks Chuck
|
|
|
|
|
I don't have a code snippet but you can use a template column in edit mode. Put all the fields in one template.
I didn't get any requirements for the signature
|
|
|
|
|
Given that I have a crystal crosstab report with salesmen on the left column and months across the top, with the intersection being the number of sales made that month.
Jan Feb Mar
Joe 5 7 4
Mary 12 6 8
How can I make the number of sales made for a given salesman / month combination a hyperlink with the corresponding query parameters ?
Something like this, "http://myserver/myapp/mySubreport.aspx?User=Joe&Month=Feb"
I'm currently using a formula in the "HyperLink" section of crosstab to generate a URL, however the URL that is generated by the function is the same value regardless of which "count of sales" field I click on.
For example, if I click on the first count,5, the URL is "http://myserver/myapp/mySubreport.aspx?User=Joe&Month=Jan" (good)
However, when I click on any of the other counts, say 7,4,12,6 or 8, the exact same URL is being generated.
How can I write the HyperLink formula to generate the desired values ?
OR
How else can I solve this problem ? Basically, I'm looking to create a crosstab report with the ability to drill-through to a more detailed report.
Thanks in advance.
David
|
|
|
|
|
what is your solution?
i have the same issue.
Tommy
|
|
|
|
|
I have two tables. Roles and Users. In Roles I have three columns iID(PK
|
|
|
|
|
I think your design is missing a table.
Typically this type of situation is implemented as follows:
Users table (contains a list of valid users)
Roles table (contains a list of valid roles)
RoleMembership (this shows which users are associated with which roles)
For example:
Users: A,B,C
Roles: R1, R2, R3
Role Membership
A,R1
A,R2
B,R1
C,R1
C,R3
|
|
|
|
|
Hi,
I am using membership and roles to secure my web site. Instead of creating data base in APP folder I want to excess my tables named Users and Roles into my sql server database. How can Ido that.
Regards,
|
|
|
|
|
Hello Friends, I am new to asp.net , so please help me out.
I have made a small gridview ( without any database connectivity) on page(Default.aspx). The user fills up one of the column with numeric data & clicks a button & control is transferred to another
page(Results.aspx).
Can anybody tell me how can I pass the whole gridview as session varaible & then retrieve it in another page & further retrieve the column filled up by the user.
Code in "Result.aspx"
protected void Page_Load(object sender, EventArgs e)
{
DataView dv1 = new DataView();
DataTable dt1 = new DataTable();
Session["A"] = dv1.Table.Columns["A"];
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
// double[] data = new double[Session["A"]]; // WRONG CODE . PLEASE CORRECT IT
// WRITE CODE FOR RETRIEVING COLUMN THAT USER HAS FILLED UP IN GRIDVIEW IN default.aspx
}
Code in "Default.aspx" :
protected void Button1_Click(object sender, EventArgs e)
{
Server.Transfer("NewPage.aspx");
// HOW TO PASS GRIDVIEW ALONG WITH USER DATA
}
|
|
|
|
|
//Default.aspx
protected void Button1_Click(object sender, EventArgs e)
{
Session["A"] = GridView1.Columns["A"];
Server.Transfer("NewPage.aspx");
}
//Result.aspx
protected void Page_Load(object sender, EventArgs e)
{
GridViewColumn col = (GridViewColumn)Session["A"];
GridView2.Columns.Add(col);
}
|
|
|
|
|
You don't store presentation objects and pass them around. Have you even tried this? I doubt it very much
only two letters away from being an asset
|
|
|
|
|
ashutosh_karna wrote: how can I pass the whole gridview as session varaible
You don't want to do that. GridView is just a presentation of the data. You don't pass textboxes and other such controls between pages do you?
Allow the users to fill in the data, save it, then transfer to the next page, retrieve the data and present it on that page.
In anticipation of the line of thought, no you don't want to save the DataSet, or whatever storage object you are using, in session state either. A DataSet can take quite a bit of memory depending on what is in it, it wouldn't scale very well.
only two letters away from being an asset
|
|
|
|
|
The code above actually saves the data in a session. If he doesn't want to do the saving in the first page better save data into a Session and retrieve in the second page. Less burden on the Database too.
|
|
|
|
|
Ibrahim Bello wrote: Less burden on the Database too.
And when the data being stored in session is large or the number of concurrent users is high?
only two letters away from being an asset
|
|
|
|
|
No, surely not
If that is the case (and he hasn't said whether it is) saving to database will be better.
|
|
|
|
|
(VS 2005)
I need to display a set of parts to be loaded on a truck for shipping.
After the parts are loaded on to the truck the actual number of parts is entered back into the system in a simple data entry fashion.
All of the columns should be ReadOnly=True except the Quantity Loaded field: QtyLoaded.
I want the field to be editable when the page is presented. No "Edit" links should be required since all rows in this column should be entered.
I created this asp code, with ReadOnly=False on the QtyLoaded field and it still will not let me edit this field. Is there something I am missing here?
-----------------------
<asp:gridview id="GridView1" autogeneratecolumns="False" runat="server">
<asp:boundfield datafield="QtyRequired" headertext="QtyRequired" readonly="True">
<asp:boundfield datafield="QtyUsed" headertext="Qty Used" ><="" asp:boundfield="">
<asp:boundfield datafield="QtyRemaining" headertext="Qty Remaining" ><="" asp:boundfield="">
<asp:boundfield datafield="QtyLoaded" headertext="Qty Loaded" readonly="False">
<asp:boundfield datafield="PartNumberDesc" headertext="Description">
<asp:BoundField DataField="PartNumber" HeaderText="Part Number">
-----------
Thanks
Chuck
|
|
|
|
|
Yes. If you want a field to be editable, use a template column and and a textbox or something like that.
I didn't get any requirements for the signature
|
|
|
|
|
Todd, thanks for answering...
Here is the same code except I have changed the BoundField QtyLoaded to a TemplateField.
Please tell me what I have done wrong. This field just appears as a blank non-editable field (Column).
<columns>
<asp:boundfield="" datafield="QtyRequired" headertext="QtyRequired" readonly="True">
<asp:boundfield datafield="QtyUsed" headertext="Qty Used">
<asp:templatefield headertext="Qty Loaded">
<edititemtemplate>
<asp:textbox runat="server" id="txtQtyLoaded" text="<%# DataBinder.Eval(Container, "Qtyloaded") %>">
<asp:boundfield datafield="PartNumberDesc" headertext="Description" ><="" asp:boundfield="">
<asp:boundfield datafield="PartNumber" headertext="Part Number">
Thanks again
Chuck...
|
|
|
|
|
<asp:templatefield headertext="Qty Loaded">
<asp:itemtemplate>
<asp:textbox runat="server" id="txtQtyLoaded" text="<%# DataBinder.Eval(Container, "Qtyloaded") %>">
<asp:itemtemplate>
I didn't get any requirements for the signature
|
|
|
|
|
Todd,
When I used EditItemTemplate
the QtyLoaded field was recognized.
With your change here is the error that I am getting:
System.Web.HttpException was unhandled by user code
ErrorCode=-2147467259
Message="DataBinding: 'System.Web.UI.WebControls.GridViewRow' does not contain a property with the name 'QtyLoaded'."
Source="System.Web"
StackTrace:
at System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName)
at System.Web.UI.DataBinder.Eval(Object container, String[] expressionParts)
at System.Web.UI.DataBinder.Eval(Object container, String expression)
at ASP.inventory_materialloadtruck_aspx.__DataBinding__control27(Object sender, EventArgs e) in C:\WorkOrders\Inventory\MaterialLoadTruck.aspx:line 66
at System.Web.UI.Control.OnDataBinding(EventArgs e)
at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
at System.Web.UI.Control.DataBind()
at System.Web.UI.Control.DataBindChildren()
Please advise!
Chuck...
|
|
|
|
|
Hello friends
I want to create a forum using asp.net just like one can make using joomla
or wordpress.
I have never made any. So I don't have much idea. But I need to do this asap.
If there is any code or example or any sort of thing that will help me making this please let me know.
Thanking in advance
Johnny
|
|
|
|
|
You need to read the link in my sig. It explains what you need to know.
Christian Graus
Driven to the arms of OSX by Vista.
Please read this[ ^] if you don't like the answer I gave to your question.
|
|
|
|
|
I have a table "custmsgrecieved" with columns as-
CustId,Message,DateofMsg,Subject,Status,FromBrokerId(may have NULL value),FromAdminId,MsgId(may have NULL value)
I have a gridview with diff columns.One of column is binded with "Name".This "Name" is defined below in sql quey.I have to pick up this table in my gridview.I have a query-
"select cust.*,brok.FirstName+' '+brok.LastName as Name,
from custmsgrecieved as cust,brokerdetails as brok
where cust.CustId='1001' and brok.BrokerId=cust.FromBrokerId"
here "brokerdetails" is another table which contains BrokerId,FirstName,LastName as columns.
Now problem is arising that when there is a NULL value in FromBrokerId in custmsgrecieved table then that row is not appearing in gridview.
and if following sql is used-
"select cust.*,brok.FirstName+' '+brok.LastName as Name,
from custmsgrecieved as cust,brokerdetails as brok
where cust.CustId='1001' or brok.BrokerId=cust.FromBrokerId"
then that row is appeared no. of times equal to no. of rows in brokerdetails.
I want that in gridview row correspondimg to FromBrokerId=NULL in custmsgrecieved appears as it is that is appear one time and also that column of gridview binded with "Name" has text "administrator".
plz help me...
|
|
|
|
|
I'm not sure if I follow what you're saying or asking, but I believe you want to use a JOIN statement in your SQL
SELECT ...
FROM Table1
JOIN Table2 on Table2.field = Table1.field
only two letters away from being an asset
|
|
|
|