Solved

try to update gridview, but getting nulls

Posted on 2011-02-15
1
271 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
1 Comment
 
LVL 29

Accepted Solution

by:
Kumaraswamy R earned 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

914 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now