Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

try to update gridview, but getting nulls

Posted on 2011-02-15
1
Medium Priority
?
277 Views
Last Modified: 2012-05-11
I have this gridview, but when i update it, the columns become null

any thoughts?  thanks

Here is my code


<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
        CellPadding="4" DataSourceID="SqlDataSource3" ForeColor="#333333"
        GridLines="Horizontal" DataKeyNames="emr_id">
        <RowStyle BackColor="#EFF3FB" />
        <Columns>
            <asp:CommandField ShowEditButton="True" />
            <asp:BoundField DataField="Date" HeaderText="Date" ReadOnly="True"
                SortExpression="Date" />
            <asp:BoundField DataField="Pain" HeaderText="Pain" SortExpression="Pain" />
            <asp:BoundField DataField="Subjective" HeaderText="Subjective"
                SortExpression="Subjective" />
            <asp:BoundField DataField="ROM" HeaderText="ROM" SortExpression="ROM" />
            <asp:BoundField DataField="Strength" HeaderText="Strength"
                SortExpression="Strength" />
            <asp:BoundField DataField="emr_id" HeaderText="emr_id" InsertVisible="False"
                ReadOnly="True" SortExpression="emr_id" />
        </Columns>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server"
        ConnectionString="<%$ ConnectionStrings:rena3ConnectionString1 %>"
        DeleteCommand="DELETE FROM [emr] WHERE [emr_id] = @emr_id"
        InsertCommand="INSERT INTO [emr] ([pt_id], [md_id], [emr_date], [therapist_id], [emr_dx1], [emr_dx2], [emr_contra], [emr_cpt_ie], [emr_cpt_estim], [emr_cpt_therex], [emr_cpt_reed], [emr_cpt_mt], [emr_cpt_theract], [emr_cpt_gait], [emr_total], [emr_cx], [emr_subj], [emr_obj], [emr_obj2], [emr_obj3], [emr_obj4], [emr_fnl], [emr_mod1], [emr_body1], [emr_time1], [emr_mod2], [emr_body2], [emr_time2], [emr_therex], [emr_stm], [emr_stretch], [emr_mob], [emr_neuro], [emr_ex], [emr_hep], [emr_progress], [emr_goals], [emr_plan], [chkTherEx], [emr_timeEntered], [emr_manual_therapy], [emr_pain], [emr_thera_act]) VALUES (@pt_id, @md_id, @emr_date, @therapist_id, @emr_dx1, @emr_dx2, @emr_contra, @emr_cpt_ie, @emr_cpt_estim, @emr_cpt_therex, @emr_cpt_reed, @emr_cpt_mt, @emr_cpt_theract, @emr_cpt_gait, @emr_total, @emr_cx, @emr_subj, @emr_obj, @emr_obj2, @emr_obj3, @emr_obj4, @emr_fnl, @emr_mod1, @emr_body1, @emr_time1, @emr_mod2, @emr_body2, @emr_time2, @emr_therex, @emr_stm, @emr_stretch, @emr_mob, @emr_neuro, @emr_ex, @emr_hep, @emr_progress, @emr_goals, @emr_plan, @chkTherEx, @emr_timeEntered, @emr_manual_therapy, @emr_pain, @emr_thera_act)"
        ProviderName="<%$ ConnectionStrings:rena3ConnectionString1.ProviderName %>"
        SelectCommand="SELECT CONVERT (CHAR(10), emr_date, 101) AS Date, emr_pain AS Pain, emr_subj AS Subjective, emr_obj2 AS ROM, emr_obj3 AS Strength, emr_id FROM emr WHERE (pt_id = @pt) ORDER BY emr_date DESC, emr_id DESC"
       
        UpdateCommand="UPDATE emr SET emr_date = @emr_date, emr_subj = @emr_subj, emr_obj2 = @emr_obj2, emr_obj3 = @emr_obj3, emr_pain = @emr_pain WHERE (emr_id = @emr_id)">
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList1" Name="pt"
                PropertyName="SelectedValue" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="emr_id" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="pt_id" Type="Int32" />
            <asp:Parameter Name="md_id" Type="String" />
            <asp:Parameter Name="emr_date" Type="DateTime" />
            <asp:Parameter Name="therapist_id" Type="Int32" />
            <asp:Parameter Name="emr_dx1" Type="String" />
            <asp:Parameter Name="emr_dx2" Type="String" />
            <asp:Parameter Name="emr_contra" Type="String" />
            <asp:Parameter Name="emr_cpt_ie" Type="Int32" />
            <asp:Parameter Name="emr_cpt_estim" Type="Int32" />
            <asp:Parameter Name="emr_cpt_therex" Type="Int32" />
            <asp:Parameter Name="emr_cpt_reed" Type="Int32" />
            <asp:Parameter Name="emr_cpt_mt" Type="Int32" />
            <asp:Parameter Name="emr_cpt_theract" Type="Int32" />
            <asp:Parameter Name="emr_cpt_gait" Type="Int32" />
            <asp:Parameter Name="emr_total" Type="Int32" />
            <asp:Parameter Name="emr_cx" Type="String" />
            <asp:Parameter Name="emr_subj" Type="String" />
            <asp:Parameter Name="emr_obj" Type="String" />
            <asp:Parameter Name="emr_obj2" Type="String" />
            <asp:Parameter Name="emr_obj3" Type="String" />
            <asp:Parameter Name="emr_obj4" Type="String" />
            <asp:Parameter Name="emr_fnl" Type="String" />
            <asp:Parameter Name="emr_mod1" Type="String" />
            <asp:Parameter Name="emr_body1" Type="String" />
            <asp:Parameter Name="emr_time1" Type="String" />
            <asp:Parameter Name="emr_mod2" Type="String" />
            <asp:Parameter Name="emr_body2" Type="String" />
            <asp:Parameter Name="emr_time2" Type="String" />
            <asp:Parameter Name="emr_therex" Type="String" />
            <asp:Parameter Name="emr_stm" Type="String" />
            <asp:Parameter Name="emr_stretch" Type="String" />
            <asp:Parameter Name="emr_mob" Type="String" />
            <asp:Parameter Name="emr_neuro" Type="String" />
            <asp:Parameter Name="emr_ex" Type="String" />
            <asp:Parameter Name="emr_hep" Type="String" />
            <asp:Parameter Name="emr_progress" Type="String" />
            <asp:Parameter Name="emr_goals" Type="String" />
            <asp:Parameter Name="emr_plan" Type="String" />
            <asp:Parameter Name="chkTherEx" Type="String" />
            <asp:Parameter Name="emr_timeEntered" Type="DateTime" />
            <asp:Parameter Name="emr_manual_therapy" Type="String" />
            <asp:Parameter Name="emr_pain" Type="String" />
            <asp:Parameter Name="emr_thera_act" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="emr_date" Type="DateTime" />
            <asp:Parameter Name="emr_subj" Type="String" />
            <asp:Parameter Name="emr_obj2" Type="String" />
            <asp:Parameter Name="emr_obj3" Type="String" />
            <asp:Parameter Name="emr_pain" Type="String" />
            <asp:Parameter Name="emr_id" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
0
Comment
Question by:ptemo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 29

Accepted Solution

by:
Kumaraswamy R earned 2000 total points
ID: 34905351
I hope in the Page load and after the ispostback lossing all the  value.(emr_date,emr_subj,emr_obj2,emr_obj3,emr_pain,emr_id

Create a Property in page load, store the values use it
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question