Click here to Skip to main content
15,847,748 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Removing a Sub Page_Load()? Pin
jkirkerx23-Jun-14 17:02
professionaljkirkerx23-Jun-14 17:02 
GeneralRe: Removing a Sub Page_Load()? Pin
Member 876166723-Jun-14 17:23
Member 876166723-Jun-14 17:23 
QuestionThe connection String property has not been initialized? Error Pin
Inayat ali jan21-Jun-14 9:45
Inayat ali jan21-Jun-14 9:45 
AnswerRe: The connection String property has not been initialized? Error Pin
Member 1089879721-Jun-14 20:47
Member 1089879721-Jun-14 20:47 
QuestionMVC Razor: Getting a user id stored in Entity Framework when calling the Controller that Display Profile View. Pin
Stephen Holdorf21-Jun-14 8:57
Stephen Holdorf21-Jun-14 8:57 
QuestionMVC Razor: Dynamically displaying and hiding UI text controls in the parent View and it's partial Views. Pin
Stephen Holdorf21-Jun-14 8:43
Stephen Holdorf21-Jun-14 8:43 
Questionmsbuild with no Visual Studio (Yes Windows SDK installed & Copy Local=true) Pin
devvvy20-Jun-14 12:26
devvvy20-Jun-14 12:26 
QuestionStore gridview selected row values in sessions Pin
hilbiazhar20-Jun-14 2:49
hilbiazhar20-Jun-14 2:49 
I want to store the values of a Gridview selected row in sessions through a button field in the gridview but
its giving me a "Index out of range " error at
C#
GridViewRow row = AdminSearchGridView.Rows[index]

Note: There is only one row in the gridview currently from which I want to select the values I want.
I checked that the e.CommandArgument is returning a int value 0 but
i cannot figure out what is going wrong since AdminSearchGridView.Rows[0] makes sense as there is a row in the gridview
then why Index out of range.?


Here is my code for Gridview...

C#
<asp:GridView ID="AdminSearchGridView" runat="server" AutoGenerateColumns="False"
Style="color: #333333; border-collapse: collapse; font-size: 14px; 
text-align: center;width: 1530px; margin-left: 0px; margin-top: 0px" CellPadding="4" ForeColor="#333333"
AutoGenerateDeleteButton="True" DataKeyNames="ID" OnRowDeleting="AdminSearchGridView_RowDeleting"
OnRowCommand="AdminSearchGridView_RowCommand">
<AlternatingRowStyle BackColor="White" />

     <Columns>
<asp:ButtonField ButtonType="Button" Text="Issue" CommandName="Issue" />
 <asp:BoundField DataField="IssueStatus" HeaderText="Issue Status" />
 <asp:BoundField DataField="AccessionNo" HeaderText="Accession Number" />
 <asp:BoundField DataField="CallNo" HeaderText="Call Number" />
 <asp:BoundField DataField="Title" HeaderText="Title" />
    </Columns>
    </asp:GridView>


Here is Code Behind...
C#
protected void AdminSearchGridView_RowCommand(object sender, GridViewCommandEventArgs e)
  {
   if (e.CommandName == "Issue")
      {
        int index = Convert.ToInt32(e.CommandArgument);

 GridViewRow row = AdminSearchGridView.Rows[index]; // INDEX OUT OF RANGE ERE

 string accessno = AdminSearchGridView.Rows[index].Cells[3].Text;
 string title = AdminSearchGridView.Rows[index].Cells[5].Text;
                

       Session["accessno"] = accessno;
       Session["title"] = title;
             }
         }

AnswerRe: Store gridview selected row values in sessions Pin
Deflinek20-Jun-14 10:02
Deflinek20-Jun-14 10:02 
QuestionHow to send a mail from local SMTP server. Pin
Kandepu Rajesh18-Jun-14 12:18
Kandepu Rajesh18-Jun-14 12:18 
SuggestionRe: How to send a mail from local SMTP server. Pin
Richard MacCutchan18-Jun-14 23:35
mveRichard MacCutchan18-Jun-14 23:35 
GeneralRe: How to send a mail from local SMTP server. Pin
Kandepu Rajesh19-Jun-14 14:31
Kandepu Rajesh19-Jun-14 14:31 
GeneralRe: How to send a mail from local SMTP server. Pin
Richard MacCutchan19-Jun-14 23:37
mveRichard MacCutchan19-Jun-14 23:37 
GeneralRe: How to send a mail from local SMTP server. Pin
Kandepu Rajesh20-Jun-14 11:11
Kandepu Rajesh20-Jun-14 11:11 
GeneralRe: How to send a mail from local SMTP server. Pin
Richard MacCutchan20-Jun-14 13:57
mveRichard MacCutchan20-Jun-14 13:57 
GeneralRe: How to send a mail from local SMTP server. Pin
Kandepu Rajesh23-Jun-14 12:40
Kandepu Rajesh23-Jun-14 12:40 
GeneralRe: How to send a mail from local SMTP server. Pin
Richard MacCutchan25-Jun-14 16:16
mveRichard MacCutchan25-Jun-14 16:16 
GeneralRe: How to send a mail from local SMTP server. Pin
Kandepu Rajesh26-Jun-14 17:12
Kandepu Rajesh26-Jun-14 17:12 
GeneralRe: How to send a mail from local SMTP server. Pin
Richard MacCutchan27-Jun-14 6:56
mveRichard MacCutchan27-Jun-14 6:56 
GeneralRe: How to send a mail from local SMTP server. Pin
Kandepu Rajesh27-Jun-14 11:59
Kandepu Rajesh27-Jun-14 11:59 
GeneralRe: How to send a mail from local SMTP server. Pin
Richard MacCutchan27-Jun-14 14:24
mveRichard MacCutchan27-Jun-14 14:24 
AnswerRe: How to send a mail from local SMTP server. Pin
Richard Deeming19-Jun-14 2:24
mveRichard Deeming19-Jun-14 2:24 
GeneralRe: How to send a mail from local SMTP server. Pin
Kandepu Rajesh19-Jun-14 14:32
Kandepu Rajesh19-Jun-14 14:32 
AnswerRe: How to send a mail from local SMTP server. Pin
Swinkaran19-Jun-14 16:16
professionalSwinkaran19-Jun-14 16:16 
QuestionSystem.InvalidOperationException TimeOut Expired. Pin
Member 1071694918-Jun-14 5:15
Member 1071694918-Jun-14 5:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.