Solved

try to update gridview, but getting nulls

Posted on 2011-02-15
1
275 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 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

630 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