Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 13th, 2008, 05:48 AM
Authorized User
 
Join Date: Sep 2007
Location: Mumbai, Maharastra, India.
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.



 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:05 PM.


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