Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2008, 05:48 AM
Authorized User
 
Join Date: Sep 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default GridView

hi,
I hv taken a gridview And SqlDataSource in asp.net2.0.
Now i want to update my records through gridview using store porcedure.
Now my store procedure hv 4 parameters.
How i can set more than one column in DatKey i grid view .
  <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" AutoGenerateEditButton="True"
                        BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"
                        CellPadding="3" DataSourceID="SqlDataSource2" GridLines="Horizontal" OnRowEditing="GridView1_RowEditing"
                        OnRowUpdated="GridView1_RowUpdated" OnSelectedIndexChanged="GridView1_SelectedIndexCha nged" DataKeyNames="CustId" Height="198px" Width="1027px">
                        <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                        <RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
                        <Columns>
                            <asp:TemplateField HeaderText="History">
                               <ItemTemplate>
                               <a href="javascript:History(1234)">History</a>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="DDLBranchName">
                            <ItemTemplate>
                            <asp:DropDownList ID="temBranch" DataSourceID="SqlDataSource1" DataTextField="BRANCHNAME" DataValueField="BRANCHID" runat="server"></asp:DropDownList>
                            </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="MFI NAME" HeaderText="Mfi Name" SortExpression="MFI NAME" />
                            <asp:BoundField DataField="BRANCH NAME" HeaderText="Branch Name" SortExpression="BRANCH NAME" />
                            <asp:BoundField DataField="APPLICANT" HeaderText="Applicant" SortExpression="APPLICANT" />
                            <asp:BoundField DataField="Loan Amount" HeaderText="Loan Amount" SortExpression="Loan Amount" />
                            <asp:BoundField DataField="Loan Date" HeaderText="Loan Date" SortExpression="Loan Date" />
                            <asp:BoundField DataField="Sanction Amount" HeaderText="Sanction Amount" SortExpression="Sanction Amount" />
                            <asp:BoundField DataField="Sanction Date" HeaderText="Sanction Date" SortExpression="Sanction Date" />
                            <asp:TemplateField HeaderText="LinKButtonHistory">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%#Eval("Custid")%>' CommandName="ppppp" OnClientClick="History" >Link History Button</asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
                        <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
                        <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
                        <AlternatingRowStyle BackColor="#F7F7F7" />
                    </asp:GridView>

        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestJobConnectionString %>"
            SelectCommand="sp_DDL_BRANCH" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:FormParameter DefaultValue="" FormField="DropDownList1" Name="MFIID" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:TestJobConnectionString %>"
            SelectCommand="sp_gdv_LMS" SelectCommandType="StoredProcedure" UpdateCommand="sp_UpdLMS" UpdateCommandType="StoredProcedure">
            <SelectParameters>
                <asp:FormParameter FormField="DropDownList1" Name="MFIID" Type="String" />
                <asp:FormParameter DefaultValue="" FormField="DropDownList2" Name="BRANCHID" Type="String" />
            </SelectParameters>
          <UpdateParameters>
                <asp:Parameter Name="MFIID" Type="String" />
                <asp:Parameter Name="BRANCHID" Type="String" />
                <asp:Parameter Name="CUSTID" Type="String" />
                <asp:Parameter Name="SanctionAmt" Type="Decimal" />
                <asp:Parameter Name="SanctionDate" Type="DateTime" />
            </UpdateParameters>

        </asp:SqlDataSource>


================================================
CREATE PROCEDURE sp_UpdLMS
@MFIID as char(10),
@BRANCHID as char(10),
@CUSTID as varchar(20),
@SanctionAmt as decimal(18,0),
@SanctionDate as smalldatetime
AS
BEGIN
update dbo.T_LoanMS set
SanctionDate = @SanctionDate,
SanctionAmount = @SanctionAmt
where
MFIID = @MFIID AND
BranchId = @BRANCHID AND
CustID = @CUSTID
END
GO

Can any one help me Plz.








Similar Threads
Thread Thread Starter Forum Replies Last Post
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
Gridview user007 ASP.NET 2.0 Basics 2 June 22nd, 2008 09:30 AM
Gridview Thinlizzy ASP.NET 2.0 Basics 2 July 20th, 2007 08:33 AM
GridView Sheraz Khan ASP.NET 2.0 Basics 1 July 19th, 2007 10:28 AM
GridView heba ASP.NET 2.0 Professional 0 May 28th, 2007 01:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.