|
Welcome to Code Project, it can be a very useful resource, however, it can also be a very harsh place for people who don't put forth some effort or only want code given to them. That being said I find it difficult to believe you could not find anything useful in the 5,300,000 results[^] returned from Google when searching for "asp.net datagrid". Especially since the first result is "An Extensive Examination of the DataGrid Web Control"
No comment
|
|
|
|
|
Hey,
Yeah there is a bunch of examples but everything i found was dealing with the Wizzard or an example i didn't understand.
[^]
But I think thats my answer right there? See I found bunch like that just no explanation.I can't find any example that are not using the Wizzard with explanations.
|
|
|
|
|
Right now I am trying to get a detailsview control to update one record in the database. I am using the smallest version of the code so I can make certain the update will work before I add more code. Right now in the new application, I have the first webform page entered by the user, they click the next button and they are directed to the second webform page. When the user is directed to the second webform page, the detailsview control for one record will be displayed.
I want the record to update a record when the user clicks a button not contained within the detailsview control. However the update has not occurred. I have tried lots of different options but nothing has worked so far. For example, I read lots of sources that said I should not have a 'new' statement in the select. However if I leave out the 'new' part of the select statements, I get an error.
What you do think I should do, have a update statement in the in the linq data source, use 2 different linq data sources, what do you think I should try to do to to make the code work.
The following is my code so far:
<pre>
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="Support.AttDataContext"
Select="new (Att_id, Prior_Cutoff_Date)"
TableName="Attestations" Where="Att_id == @Att_id"
EnableUpdate="True">
<UpdateParameters>
<asp:SessionParameter Name="Att_id" SessionField="AttID" />
</UpdateParameters>
<WhereParameters>
<asp:SessionParameter Name="Att_id" SessionField="AttID" Type="Int32" />
</WhereParameters>
</asp:LinqDataSource>
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" EnableModelValidation="False"
AutoGenerateRows="False" DataSourceID="LinqDataSource1" BorderStyle="Solid" HorizontalAlign="Center"
DefaultMode="Edit">
<Fields>
<asp:TemplateField HeaderText="Att ID">
<ItemTemplate>
<asp:TextBox ID="TextBoxAttid" runat="server" Text='<%# Eval("Att_id") %>'
BorderStyle="None"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Prior Cutoff Date" SortExpression="Prior_Cutoff_Date">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("Prior_Cutoff_Date") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Prior_Cutoff_Date") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>
protected void Button_Click(object sender, EventArgs e)
{
DetailsView1.DataBind();
}
</pre>
-- modified 17-Nov-11 17:19pm.
|
|
|
|
|
im very new to asp.net.
i develop a website for e-commerce..now i developing a page to display the statistic of the product that bought by costumer..
here is my database structure..
Table Product-ProductID,ProductName,Description
Table Transaction-TransactionID,User,ProductID,Quantity
-in table Transaction, i store the product that bought by user with user name and quantity.
-table product, store the information about product
-this is my data, assume Bag ProductID=1 and Pencil ProductID=2 in table transaction..
-for table transaction:
TransactionID | User | ProductID | Quantity
1 | ali | 1 | 2
1 | abu | 2 | 3
1 | qwe | 1 | 5
i want make a statistic about the product that bought by users..
im using this Select query= "SELECT Product.ProductName, COUNT(Transaction.ProductID) AS ProductCount FROM Product INNER JOIN Transaction ON Product.ProductID = Transaction.ProductID GROUP BY Product.ProductName"
when using this query the result is,
ProductName | ProductCount
Bag | 2
Pencil | 1
i just want my result shown like i stated below..but i dont know how to do it..
ProductName | ProductCount
Bag | 7
Pencil | 3
please help me....
|
|
|
|
|
Try this query instead:
SELECT DISTINCT Product.ProductName, SUM(Transaction.Quantity) AS ProductCount
FROM Product INNER JOIN Transaction ON Product.ProductID = Transaction.ProductID
GROUP BY Product.ProductName By using COUNT, you were counting the number of lines that corresponded in the result set, not the total.
|
|
|
|
|
just a note but next time don't format your whole question as code. I completely ignored your request because I didn't want to sort through your comments and your code.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
hi friends
i have a secure page(a page which is viewable after i login say page1.aspx) in page1.aspx i have a imagebutton. On the click of this image button i need to navigate to another page say page2.aspx which is also a secure page(this page is also viewed after i login but i have already loged in and viewed page1.aspx) so how to doit
so plz do help me in this issue
K.Gayathri
|
|
|
|
|
This is no different than navigating to any other page, secured or unsecured
No comment
|
|
|
|
|
hi
i am not able to navigate between secure pages(all kept inside a folder by name secure) as i have set in the web.config file inside the secure folder as follows:
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<authorization >
<deny users="?"/>
</authorization>
</system.web>
</configuration>
i have set so because no one should access these pages without logging in......plzzzzzzzzzzz do help me
K.Gayathri
|
|
|
|
|
If the user has already logged in then they have been authenticated and have access to any of the pages. How are trying to navigate?
No comment
|
|
|
|
|
hi
thanks for the reply
yes if the user is logged in he should be able to access the other secure pages now but since i have given
after login successfully the user enter a secure page say by using the code
Server.Transfer("~/Secure/Dashboard.aspx");
so now if i am in dashboard.aspx i have some more secure pages in the same secure folder which is accessible once the user is logged in and is in dashboard.aspx...so how to do it
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<authorization >
<deny users="?"/>
</authorization>
</system.web>
</configuration>
it is redirecting to the login page itself
K.Gayathri
|
|
|
|
|
|
hi friend
i am using form authentication using sqlserver as my database and not web.config
so that part i am ok as i can compare the values from the database using my own code and getting redirection to a secure page
but my problem now is that
from that secure page how to move to other pages which are secure
K.Gayathri
|
|
|
|
|
Not using web.config? This makes no sense at since you have shown the web.config you are using. You can't use form auth without it. Good luck.
No comment
|
|
|
|
|
hi friend
i am using web.config file only
but i am comparing the values from the database and i am not using credentials ok....you got it now what i say
so after i validate from the database i enter a secured page and from that secured page i am not able to navigate to another secured page.....
hope you got me now
K.Gayathri
|
|
|
|
|
MalarGayu wrote: i am using form authentication using sqlserver as my database and not web.config so that part i am ok as i can compare the values from the database using my own code and getting redirection to a secure page
Your problem probable exists in how you are doing your authorization. It sounds like you are not using the default log-in and membership provider in asp.net by your statement above. Show us the code that you are using to log someone into your site.
|
|
|
|
|
I think this has been addressed in some capacity a few times, but nothing recently, and nothing that addresses my exact needs. So here goes...
I am looking for suggestions to accomplish the following in ASP.NET.
The Nutshell:
I need to take a string value, from a text box on a web form, and provide it in a PDF file for download. The PDF file will also include a static graphic.
The Details:
My thoughts right now are that I should probably start with something other than a PDF that contains the static graphic, add the text, and then convert to PDF. I thought this would be possible using MS Word, but understand that there are issues when doing this on a Windows 2008 Server - which is my environment.
Ideally, I'd like to avoid a 3rd party library or application unless it's free or very cheap. The project is just as small as it sounds and can't afford the overhead.
|
|
|
|
|
I guess the best way to do this is to create the page in HTML and then convert it to PDF.
There is a free tool here http://code.google.com/p/wkhtmltopdf/[^] but I have not used it myself with C# or so!
Sojaner!
|
|
|
|
|
Maybe you can try this...
itextsharp[]
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
I am using unobtrusive validation to validate a form. It works in most of the browsers - IE7, IE8 in compatibility mode, FF and Chrome. However, in IE8 stand-alone mode, it fires the validation and message is shown. When I go to the field and retype the value there, the browser hangs after the first key press. The error message is not automatically disappearing. This happens for all forms and for all types of validation attributes - Required, Remote or Regular expression.
I am using jquery 1.6.2 and jquery validation 1.9
Could anybody please help me ?
Many thanks,
Madhu
|
|
|
|
|
I will state what the user wants and then I will ask what control would be the best to accomplish this task.
The user wants a list of prepopulated fields for one row in a table. The user does not want me to leave some date fields as editable right off the bat. The user wants to be able to select yes from a droplist to indicate that a 'prepoplated date column value is invalid'. If the date field is incorrect, user want a dropdown field to display so they can enter the correct date.
The following are the options I am considering:
1. I am thinking that I would use a detailsview control. However I am wondering if one of these options are possible with a detailsview control?
a. Can that automatic dropdown field to enter a date possible with a detailsview control? If so, how would you accomplish this task? If not, could I use an accordion ajax control in the appropriate spot for the selected dropdown fields where the date needs to be entered?
b. Since the user wants all the date fields to be readonly initally, could I somehow disable the EditItemTemplate availability initially? When the user clicks on the control that says 'yes', the EditItemTemplate availability could be enabled and the user can change the value at that time only? If so, how would you accomplish this task?
2. If one of these options are not available in a detailsview control, could I accomplish my goal by using a formview control or possibly using a listview control using a single row being displayed? if this is an option, what control would I use and do you have references I can use on how to accomplish this goal?
3. If the above options are not available, the only think I can think to do is to embedded lots of individual standard we controls like a textbox, labeel, and dropdown list boxes within a large asp.net table control. I would then use accordion ajax control. However I do not want to use a big asp.net web table control since that is the 'old' style of coding.
|
|
|
|
|
I'm not sure if I completely understand. You want a row of label controls that display some dates, each of which will have a dropdown. When the user selects Yes from the dropdown the label should be changed to a dropdown that contains a list of dates. Correct?
This being the case I would not even consider using any ajax server controls that would require a postback to function. All of this can be handled on the client-side with some JavaScript. Handle the select event of the Yes/No dropdown and hide the label while showing a dropdown in its place. Handle the select event on this dropdown to do the reverse, hide the dropdown and show the label with the selected value. If the date dropdowns all contain the same values you don't even need multiple dropdowns. You can have one and clone it or position it as necessary.
The question though is how are you planning to post the updated data, if any, to the server?
rachel_m wrote: that is the 'old' style of coding.
Explain this? The table element was created to display tabular data. If that is what you have then use it. If you are using it just for layout, then no, there are better methods.
No comment
|
|
|
|
|
The following is in response to your questions and I few extra items to mention:
1. There are two webpages. The first webpage (that I did not mention in the first post), will load values into the main master table when the user clicks the next button to go to the second webpage (the page I have a question about). The first page will load data the user enters, set all the default values in appropriate columns.
The first page will also load various dates into the master table based upon the 'process date' the user enters on the first web page. The 'process date' is the key to a default schedule table due date schedules that are customers are suppose to follow. (The default tables may need to be changed in master table if the customer(s) submit work past the expected due date).
2. in response to your statement, "I'm not sure if I completely understand. You want a row of label controls that display some dates, each of which will have a dropdown. When the user selects Yes from the dropdown the label should be changed to a dropdown that contains a list of dates. Correct?" no.
For each of the 5 default dates that can be entered, there will be the following:
a. There will be a textbox field displaying what the value should be entered into the master table. There will be another column that will be a dropdown list asking if the applicable date is invalid. The assumption is no dates are invalid.
(In the database, there is a column for date1 and in the database there is also a yes-no column for date1. There is a column for date2 and there is a yes-no column for date2. This applies for the other 3 date fields and their corresponding yes-no columns.)
So if the user clicks the dropdownlist to say date1 is invalid, they want an extra textbox to show up where they can enter the correct date. The user does not want to be allowed to enter the 'corrected date' accidently. They want to be able to only enter the correct date when they click the dropdown control saying the date is invalid.
3. In response to your statement," This being the case I would not even consider using any ajax server controls that would require a postback to function. All of this can be handled on the client-side with some JavaScript. Handle the select event of the Yes/No dropdown and hide the label while showing a dropdown in its place. Handle the select event on this dropdown to do the reverse, hide the dropdown and show the label with the selected value. If the date dropdowns all contain the same values you don't even need multiple dropdowns. You can have one and clone it or position it as necessary."
a. I was thinking of using all server controls since these two webpages are used by only one or two users for 3 to 5 days monthly. The webpages are being setup since they are a requirement by our customers.
b. Since this is my first set of web pages that i am every writing can you tell me what kind of javascript commands you recommend that I use?
4. In response to your statement,"The question though is how are you planning to post the updated data, if any, to the server?". If the user says any of the dates are invalid from the dropdown list controls, I plan on updating the database. I am told that the answer saying the value is invalid should occur only between 5 to 20% of the time.
5. In repsonse to your statement," Explain this? The table element was created to display tabular data. If that is what you have then use it. If you are using it just for layout, then no, there are better methods.". I want to use a detailsview control.
I am required to have a way for the user to only be able to edit dates if they enter yes in the dropdown list control. They do not want to be able to edit dates if they do not select yes from the dropdown list. Thus I am trying to find an asp.net 2010 web control that will meet this requirement.
|
|
|
|
|
As you are new here let me explain a few things. You don't need to say "In response to your...". Notice the button with the text "Quote Selected Text". Highlight something in the response and click this button; you will get this...
rachel_m wrote: In response to your
Another example
rachel_m wrote: The first webpage (that I did not mention in the first post)
To get the best answer and not need multiple responses to clarify points you should include all pertinent details. And do so as succinctly as possible, long posts will be ignored by most as they don't have time to read everything.
rachel_m wrote: In the database, there is a column for date1 and in the database there is also a yes-no column for date1
Why do you need to persist the yes/no? How is that relevant? What happens when a user changes the value? Yes the date is valid but No it was updated from the original? Will you store the original date? Where will you store it? How many modifications will you store?
IMO having a dropdown for a yes/no to edit a field is very cumbersome and not user friendly. Having a button that says Edit would be more appropriate. If you have five textboxes on the form and only two people that use the form, then train them to not change the date unless they want to. Some problem are best solved with humans not more technology. A textbox with a calendar like this[^] would be fine. The date won't be changed unless the user clicks in the box to display the calendar. The interface could even be displayed as a modal window rather than moving to a new page then back again. A much more pleasing user experience and a more modern design. You worry about old school controls but still use old school techniques.
rachel_m wrote: I was thinking of using all server controls since these two webpages are used by only one or two users for 3 to 5 days monthly.
The number of users and days they are expected to use the application doesn't determine the design or the controls that should be used. The functionality and requirements determines that. You do have documented requirements and designs right?
rachel_m wrote: what kind of javascript commands
There are no JavaScript commands. There are JavaScript functions that you write or you make use of JavaScript frameworks, such as JQuery[^]. You should learn which technology is best for which purpose. Making use of all server controls, although valid, is not necessary in all cases. To show or hide an element it is not necessary to make a round trip to the server to set
myControl.visibility=false; this can be done much better and faster on the client with
$("#myElement").hide()
rachel_m wrote: If the user says any of the dates are invalid from the dropdown list controls, I plan on updating the database
Well, yes, of course. But how? Labels will not be included in the post data for the form, only input controls such as textboxes. Have you considered asynchronous methods, such as AJAX? Displaying the interface as a modal dialog and using AJAX to post any updated values would be a more pleasing user experience, IMO, and more performant since you are only posting what is absolutely necessary, not using a sledge hammer ASP.NET postback method.
rachel_m wrote: this is my first set of web pages
Ever? Is there anyone in your company mentoring you or assisting with this?
No comment
|
|
|
|
|
Hey .. has anyone had a problem with updating the width of asp:Panel control in a web form, under Windows 7. This same web form code worked fine in Windows XP. But in Windows 7, the width never shows up visually as being widened.
Thanks .. Rick
|
|
|
|