Solved

try to update gridview, but getting nulls

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

739 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