Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

try to update gridview, but getting nulls

Posted on 2011-02-15
1
Medium Priority
?
278 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 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

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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 …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

886 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