Click here to Skip to main content
15,914,165 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: fileupload postback Pin
padmanabhan N3-Nov-09 21:41
padmanabhan N3-Nov-09 21:41 
GeneralRe: fileupload postback Pin
m@dhu3-Nov-09 22:10
m@dhu3-Nov-09 22:10 
AnswerRe: fileupload postback Pin
kPriyanka123-Nov-09 22:23
kPriyanka123-Nov-09 22:23 
GeneralRe: fileupload postback Pin
m@dhu3-Nov-09 23:04
m@dhu3-Nov-09 23:04 
QuestionNumberBOX (does not clear onselect ,based on cursor location) Pin
ansriharsha3-Nov-09 20:09
ansriharsha3-Nov-09 20:09 
AnswerRe: NumberBOX (does not clear onselect ,based on cursor location) Pin
Nishant Singh3-Nov-09 20:24
Nishant Singh3-Nov-09 20:24 
GeneralRe: NumberBOX (does not clear onselect ,based on cursor location) Pin
ansriharsha3-Nov-09 22:00
ansriharsha3-Nov-09 22:00 
QuestionGridview, Checkbox and SQL Parameters based on LoginName Pin
ahayw013-Nov-09 19:27
ahayw013-Nov-09 19:27 
Hello,

I am still learning ASP.NET, if you need additonal information or have questions please let me know.

I am creating a ASP.NET site (C#) in Visual Studio.NET that is utlizing a grid view to pull data from a SQL DB. I am using the ASP.NET membership provider model for the website authentication. Access to the site is only allowed with the correct username and password.

I have a webform call Document Checklist. The webform is connected to a SQL table called document_checklist. I need the Document Checklist webform to display only those documents that the logged in user has not approved. I need for the user to click on the checkbox for those documents that he has approved and click the submit button to update the SQL DB. The SQL DB contains the following columns user_name, document_name, document_url date_added, date_approved and checkbox.

I have been trying to work throught this and am not certain how to proceed.


1. I am not certain how to query the SQL DB against my LoginName I have tried a few things, but am not able to capture the value of the LoginName and compare it to user_name value of teh SQL DB field. (The formatting of LoginName from ASP.NET and user_name from SQL DB is identical.)

2. I do not know how to utilze checkbox to update the SQL DB.

3. I do not know how to capture the date that the checkbox was checked and insert it into date_approved

The code is below. I am not certain how to list the CheckBox_Changed in the code behind.

Thank you in advance for your help.

aspx C# code
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="document_checklist.aspx.cs" Inherits="members_document_checklist" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<h2>DOCUMENT CHECKLIST</h2>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
        <Columns>
            <asp:BoundField DataField="user_name" HeaderText="User Name" SortExpression="user_name" />
            <asp:TemplateField HeaderText="Document">
                <ItemTemplate>
                    <asp:HyperLink ID="Document" NavigateUrl='<%# Eval("document_url") %>' Text='<%# Eval("document_name") %>' Target="_blank" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="document_type" HeaderText="Document Type" SortExpression="document_type" />
            <asp:BoundField DataField="date_added" HeaderText="Date Added" SortExpression="date_added" />
            <asp:TemplateField>
                   <ItemTemplate>
                       <asp:CheckBox ID="CheckBox1" runat="server" />
                   </ItemTemplate>
            </asp:TemplateField>
           </Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:board_loginConnectionString3 %>"
       SelectCommand="SELECT [user_name], [document_name], [document_type], [document_url], [date_added], [checkbox] FROM [document_checklist] WHERE ([checkbox] = @checkbox) AND ([user_name] = @user_name)" >
            <SelectParameters>
                <asp:Parameter DefaultValue="0" Name="checkbox" Type="String" />
                <asp:Parameter DefaultValue="@user_name" Name="User.Identity.Name" Type="String" />
           </SelectParameters>
</asp:SqlDataSource>
    <asp:Button ID="Button1" runat="server" Text="Cancel" />
    <asp:Button ID="Button2" runat="server" Text="Submit" />
</asp:Content>




Allison
AnswerRe: Gridview, Checkbox and SQL Parameters based on LoginName Pin
Nishant Singh3-Nov-09 19:30
Nishant Singh3-Nov-09 19:30 
GeneralRe: Gridview, Checkbox and SQL Parameters based on LoginName Pin
ahayw015-Nov-09 14:15
ahayw015-Nov-09 14:15 
QuestionProblem in Displaying Huge data Pin
ballameharmurali3-Nov-09 19:16
ballameharmurali3-Nov-09 19:16 
AnswerRe: Problem in Displaying Huge data Pin
Christian Graus3-Nov-09 19:18
protectorChristian Graus3-Nov-09 19:18 
GeneralRe: Problem in Displaying Huge data Pin
_Damian S_3-Nov-09 19:25
professional_Damian S_3-Nov-09 19:25 
AnswerRe: Problem in Displaying Huge data Pin
Nishant Singh3-Nov-09 19:28
Nishant Singh3-Nov-09 19:28 
GeneralRe: Problem in Displaying Huge data Pin
padmanabhan N3-Nov-09 21:45
padmanabhan N3-Nov-09 21:45 
GeneralRe: Problem in Displaying Huge data Pin
ballameharmurali3-Nov-09 22:15
ballameharmurali3-Nov-09 22:15 
GeneralRe: Problem in Displaying Huge data Pin
padmanabhan N3-Nov-09 22:33
padmanabhan N3-Nov-09 22:33 
GeneralRe: Problem in Displaying Huge data Pin
ballameharmurali3-Nov-09 22:16
ballameharmurali3-Nov-09 22:16 
GeneralRe: Problem in Displaying Huge data Pin
Christian Graus4-Nov-09 8:57
protectorChristian Graus4-Nov-09 8:57 
QuestionXML Query in asp.net Pin
Priyagdpl3-Nov-09 18:43
Priyagdpl3-Nov-09 18:43 
AnswerRe: XML Query in asp.net Pin
Christian Graus3-Nov-09 18:45
protectorChristian Graus3-Nov-09 18:45 
AnswerRe: XML Query in asp.net Pin
Nishant Singh3-Nov-09 19:04
Nishant Singh3-Nov-09 19:04 
GeneralRe: XML Query in asp.net Pin
Christian Graus3-Nov-09 19:18
protectorChristian Graus3-Nov-09 19:18 
GeneralRe: XML Query in asp.net Pin
Nishant Singh3-Nov-09 19:39
Nishant Singh3-Nov-09 19:39 
Questionregarding datalist Pin
rahuuul173-Nov-09 18:21
rahuuul173-Nov-09 18:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.