C# NullReference, What do I Need to Initialize? [duplicate]2019 Community Moderator ElectionWhat is a NullReferenceException, and how do I fix it?How do I calculate someone's age in C#?What is the difference between String and string in C#?What does the [Flags] Enum Attribute mean in C#?Hidden Features of C#?Cast int to enum in C#How do I enumerate an enum in C#?What is the best way to iterate over a dictionary?What are the correct version numbers for C#?What do two question marks together mean in C#?Exception is System.Data.SqlClient.SqlException: Incorrect syntax near '9988'

Are small insurances worth it?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

Doubts in understanding some concepts of potential energy

Which classes are needed to have access to every spell in the PHB?

Recommendation letter by significant other if you worked with them professionally?

Why does liquid water form when we exhale on a mirror?

how to modify custom status text color in UI component grid magento 2?

Can we track matter through time by looking at different depths in space?

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

Source permutation

Does a difference of tense count as a difference of meaning in a minimal pair?

Street obstacles in New Zealand

Was it really inappropriate to write a pull request for the company I interviewed with?

I can't die. Who am I?

Outlet with 3 sets of wires

Doesn't allowing a user mode program to access kernel space memory and execute the IN and OUT instructions defeat the purpose of having CPU modes?

Does the US political system, in principle, allow for a no-party system?

How does Ehrenfest's theorem apply to the quantum harmonic oscillator?

Minimizing with differential evolution

What materials can be used to make a humanoid skin warm?

Is it a Cyclops number? "Nobody" knows!

Can I negotiate a patent idea for a raise, under French law?

Is divide-by-zero a security vulnerability?

From an axiomatic set theoric approach why can we take uncountable unions?



C# NullReference, What do I Need to Initialize? [duplicate]



2019 Community Moderator ElectionWhat is a NullReferenceException, and how do I fix it?How do I calculate someone's age in C#?What is the difference between String and string in C#?What does the [Flags] Enum Attribute mean in C#?Hidden Features of C#?Cast int to enum in C#How do I enumerate an enum in C#?What is the best way to iterate over a dictionary?What are the correct version numbers for C#?What do two question marks together mean in C#?Exception is System.Data.SqlClient.SqlException: Incorrect syntax near '9988'










0
















This question already has an answer here:



  • What is a NullReferenceException, and how do I fix it?

    31 answers



Newbie question: What exactly needs to be initialized to prevent a NullReferenceException? I don't understand what the variable is. What object reference do I need to set to an instance of what object? Thank you!



.aspx



 <p>
<asp:GridView ID="gvConvo" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="gvConvo_SelectedIndexChanged">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:LinkButton ID="lbtnConvo" OnClick="lbtnConvo_Click" Text='<%#Eval("ConvoUID") %>' runat="server">LinkButton</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Convo" HeaderText="Convo" />
<asp:BoundField DataField="ConvoDate" HeaderText="Date" />
<asp:BoundField DataField="ConvoDesc" HeaderText="Description" />
<asp:BoundField DataField="ConvoType" HeaderText="Type" />
<asp:BoundField DataField="MediaSource" HeaderText="Media Source" />
</Columns>
</asp:GridView>
</p>
<p>
&nbsp;</p>
<p>
Convo:
<asp:TextBox ID="txtConvoSelection" runat="server" OnTextChanged="txtConvoSelection_TextChanged"></asp:TextBox>
</p>


.cs



 protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

string PersuasionDBCon = ConfigurationManager.ConnectionStrings["PersuasionDBCon"].ConnectionString;
using (SqlConnection con = new SqlConnection(PersuasionDBCon))

SqlCommand cmd = new SqlCommand("GetConvo", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
gvConvo.DataSource = cmd.ExecuteReader();
gvConvo.DataBind();




protected void lbtnConvo_Click(object sender, EventArgs e)

txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;


protected void BtnSaveQuote_Click(object sender, EventArgs e)




protected void gvConvo_SelectedIndexChanged(object sender, EventArgs e)




protected void txtConvoSelection_TextChanged(object sender, EventArgs e)





This is the line that's throwing the exception:



txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;









share|improve this question













marked as duplicate by Uwe Keim c#
Users with the  c# badge can single-handedly close c# questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 7 at 5:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    Either txtConvoSelection is null, gvConvo is null, SelectedRow is null, or (less likely, frankly) Cells[1] is null.

    – John
    Mar 7 at 5:13











  • txtConvoSelection is just an empty text box that's waiting to be populated on lbtnConvo_Click. Is that the same as being null? If the value isn't null to start with, what should it be?

    – Vesper Annstas
    Mar 7 at 5:18
















0
















This question already has an answer here:



  • What is a NullReferenceException, and how do I fix it?

    31 answers



Newbie question: What exactly needs to be initialized to prevent a NullReferenceException? I don't understand what the variable is. What object reference do I need to set to an instance of what object? Thank you!



.aspx



 <p>
<asp:GridView ID="gvConvo" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="gvConvo_SelectedIndexChanged">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:LinkButton ID="lbtnConvo" OnClick="lbtnConvo_Click" Text='<%#Eval("ConvoUID") %>' runat="server">LinkButton</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Convo" HeaderText="Convo" />
<asp:BoundField DataField="ConvoDate" HeaderText="Date" />
<asp:BoundField DataField="ConvoDesc" HeaderText="Description" />
<asp:BoundField DataField="ConvoType" HeaderText="Type" />
<asp:BoundField DataField="MediaSource" HeaderText="Media Source" />
</Columns>
</asp:GridView>
</p>
<p>
&nbsp;</p>
<p>
Convo:
<asp:TextBox ID="txtConvoSelection" runat="server" OnTextChanged="txtConvoSelection_TextChanged"></asp:TextBox>
</p>


.cs



 protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

string PersuasionDBCon = ConfigurationManager.ConnectionStrings["PersuasionDBCon"].ConnectionString;
using (SqlConnection con = new SqlConnection(PersuasionDBCon))

SqlCommand cmd = new SqlCommand("GetConvo", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
gvConvo.DataSource = cmd.ExecuteReader();
gvConvo.DataBind();




protected void lbtnConvo_Click(object sender, EventArgs e)

txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;


protected void BtnSaveQuote_Click(object sender, EventArgs e)




protected void gvConvo_SelectedIndexChanged(object sender, EventArgs e)




protected void txtConvoSelection_TextChanged(object sender, EventArgs e)





This is the line that's throwing the exception:



txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;









share|improve this question













marked as duplicate by Uwe Keim c#
Users with the  c# badge can single-handedly close c# questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 7 at 5:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • 1





    Either txtConvoSelection is null, gvConvo is null, SelectedRow is null, or (less likely, frankly) Cells[1] is null.

    – John
    Mar 7 at 5:13











  • txtConvoSelection is just an empty text box that's waiting to be populated on lbtnConvo_Click. Is that the same as being null? If the value isn't null to start with, what should it be?

    – Vesper Annstas
    Mar 7 at 5:18














0












0








0









This question already has an answer here:



  • What is a NullReferenceException, and how do I fix it?

    31 answers



Newbie question: What exactly needs to be initialized to prevent a NullReferenceException? I don't understand what the variable is. What object reference do I need to set to an instance of what object? Thank you!



.aspx



 <p>
<asp:GridView ID="gvConvo" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="gvConvo_SelectedIndexChanged">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:LinkButton ID="lbtnConvo" OnClick="lbtnConvo_Click" Text='<%#Eval("ConvoUID") %>' runat="server">LinkButton</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Convo" HeaderText="Convo" />
<asp:BoundField DataField="ConvoDate" HeaderText="Date" />
<asp:BoundField DataField="ConvoDesc" HeaderText="Description" />
<asp:BoundField DataField="ConvoType" HeaderText="Type" />
<asp:BoundField DataField="MediaSource" HeaderText="Media Source" />
</Columns>
</asp:GridView>
</p>
<p>
&nbsp;</p>
<p>
Convo:
<asp:TextBox ID="txtConvoSelection" runat="server" OnTextChanged="txtConvoSelection_TextChanged"></asp:TextBox>
</p>


.cs



 protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

string PersuasionDBCon = ConfigurationManager.ConnectionStrings["PersuasionDBCon"].ConnectionString;
using (SqlConnection con = new SqlConnection(PersuasionDBCon))

SqlCommand cmd = new SqlCommand("GetConvo", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
gvConvo.DataSource = cmd.ExecuteReader();
gvConvo.DataBind();




protected void lbtnConvo_Click(object sender, EventArgs e)

txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;


protected void BtnSaveQuote_Click(object sender, EventArgs e)




protected void gvConvo_SelectedIndexChanged(object sender, EventArgs e)




protected void txtConvoSelection_TextChanged(object sender, EventArgs e)





This is the line that's throwing the exception:



txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;









share|improve this question















This question already has an answer here:



  • What is a NullReferenceException, and how do I fix it?

    31 answers



Newbie question: What exactly needs to be initialized to prevent a NullReferenceException? I don't understand what the variable is. What object reference do I need to set to an instance of what object? Thank you!



.aspx



 <p>
<asp:GridView ID="gvConvo" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="gvConvo_SelectedIndexChanged">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:LinkButton ID="lbtnConvo" OnClick="lbtnConvo_Click" Text='<%#Eval("ConvoUID") %>' runat="server">LinkButton</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Convo" HeaderText="Convo" />
<asp:BoundField DataField="ConvoDate" HeaderText="Date" />
<asp:BoundField DataField="ConvoDesc" HeaderText="Description" />
<asp:BoundField DataField="ConvoType" HeaderText="Type" />
<asp:BoundField DataField="MediaSource" HeaderText="Media Source" />
</Columns>
</asp:GridView>
</p>
<p>
&nbsp;</p>
<p>
Convo:
<asp:TextBox ID="txtConvoSelection" runat="server" OnTextChanged="txtConvoSelection_TextChanged"></asp:TextBox>
</p>


.cs



 protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

string PersuasionDBCon = ConfigurationManager.ConnectionStrings["PersuasionDBCon"].ConnectionString;
using (SqlConnection con = new SqlConnection(PersuasionDBCon))

SqlCommand cmd = new SqlCommand("GetConvo", con);
cmd.CommandType = CommandType.StoredProcedure;
con.Open();
gvConvo.DataSource = cmd.ExecuteReader();
gvConvo.DataBind();




protected void lbtnConvo_Click(object sender, EventArgs e)

txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;


protected void BtnSaveQuote_Click(object sender, EventArgs e)




protected void gvConvo_SelectedIndexChanged(object sender, EventArgs e)




protected void txtConvoSelection_TextChanged(object sender, EventArgs e)





This is the line that's throwing the exception:



txtConvoSelection.Text = gvConvo.SelectedRow.Cells[1].Text;




This question already has an answer here:



  • What is a NullReferenceException, and how do I fix it?

    31 answers







c# asp.net






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 7 at 5:10









Vesper AnnstasVesper Annstas

238




238




marked as duplicate by Uwe Keim c#
Users with the  c# badge can single-handedly close c# questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 7 at 5:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Uwe Keim c#
Users with the  c# badge can single-handedly close c# questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Mar 7 at 5:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 1





    Either txtConvoSelection is null, gvConvo is null, SelectedRow is null, or (less likely, frankly) Cells[1] is null.

    – John
    Mar 7 at 5:13











  • txtConvoSelection is just an empty text box that's waiting to be populated on lbtnConvo_Click. Is that the same as being null? If the value isn't null to start with, what should it be?

    – Vesper Annstas
    Mar 7 at 5:18













  • 1





    Either txtConvoSelection is null, gvConvo is null, SelectedRow is null, or (less likely, frankly) Cells[1] is null.

    – John
    Mar 7 at 5:13











  • txtConvoSelection is just an empty text box that's waiting to be populated on lbtnConvo_Click. Is that the same as being null? If the value isn't null to start with, what should it be?

    – Vesper Annstas
    Mar 7 at 5:18








1




1





Either txtConvoSelection is null, gvConvo is null, SelectedRow is null, or (less likely, frankly) Cells[1] is null.

– John
Mar 7 at 5:13





Either txtConvoSelection is null, gvConvo is null, SelectedRow is null, or (less likely, frankly) Cells[1] is null.

– John
Mar 7 at 5:13













txtConvoSelection is just an empty text box that's waiting to be populated on lbtnConvo_Click. Is that the same as being null? If the value isn't null to start with, what should it be?

– Vesper Annstas
Mar 7 at 5:18






txtConvoSelection is just an empty text box that's waiting to be populated on lbtnConvo_Click. Is that the same as being null? If the value isn't null to start with, what should it be?

– Vesper Annstas
Mar 7 at 5:18













2 Answers
2






active

oldest

votes


















2














The code to load the grid is surrounded by an if (!IsPostBack) block. Guess what? The button click event causes a postback. That's how it runs. And every time you do a postback, the entire page starts over from scratch. That's how HTTP works.



So when you click the button, the data for the grid is not bound, and there is no selected row.



The best fix for this is to make this happen in javascript, rather than C#. Reserve server events for things that really need to do work on the server. That will greatly improve perceived performance (no waiting for round-trips to a potentially-distant server) and help your server scale to handle more users by not needing to rebuild the entire html document for simple changes.






share|improve this answer

























  • Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

    – Vesper Annstas
    Mar 7 at 5:26












  • @VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

    – Joel Coehoorn
    Mar 7 at 5:28






  • 1





    Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

    – Joel Coehoorn
    Mar 7 at 5:30


















0














Index starts from 0
gvConvo.SelectedRow.Cells[1] this field must be null



Try



gvConvo.SelectedRow.Cells[0]


Also check for gvConvo.SelectedRow
may be there is no selected in Grid






share|improve this answer























  • Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

    – Vesper Annstas
    Mar 7 at 5:20











  • Then gvConvo.SelectedRow must be NULL

    – Ashish Sapkale
    Mar 7 at 5:45

















2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














The code to load the grid is surrounded by an if (!IsPostBack) block. Guess what? The button click event causes a postback. That's how it runs. And every time you do a postback, the entire page starts over from scratch. That's how HTTP works.



So when you click the button, the data for the grid is not bound, and there is no selected row.



The best fix for this is to make this happen in javascript, rather than C#. Reserve server events for things that really need to do work on the server. That will greatly improve perceived performance (no waiting for round-trips to a potentially-distant server) and help your server scale to handle more users by not needing to rebuild the entire html document for simple changes.






share|improve this answer

























  • Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

    – Vesper Annstas
    Mar 7 at 5:26












  • @VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

    – Joel Coehoorn
    Mar 7 at 5:28






  • 1





    Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

    – Joel Coehoorn
    Mar 7 at 5:30















2














The code to load the grid is surrounded by an if (!IsPostBack) block. Guess what? The button click event causes a postback. That's how it runs. And every time you do a postback, the entire page starts over from scratch. That's how HTTP works.



So when you click the button, the data for the grid is not bound, and there is no selected row.



The best fix for this is to make this happen in javascript, rather than C#. Reserve server events for things that really need to do work on the server. That will greatly improve perceived performance (no waiting for round-trips to a potentially-distant server) and help your server scale to handle more users by not needing to rebuild the entire html document for simple changes.






share|improve this answer

























  • Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

    – Vesper Annstas
    Mar 7 at 5:26












  • @VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

    – Joel Coehoorn
    Mar 7 at 5:28






  • 1





    Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

    – Joel Coehoorn
    Mar 7 at 5:30













2












2








2







The code to load the grid is surrounded by an if (!IsPostBack) block. Guess what? The button click event causes a postback. That's how it runs. And every time you do a postback, the entire page starts over from scratch. That's how HTTP works.



So when you click the button, the data for the grid is not bound, and there is no selected row.



The best fix for this is to make this happen in javascript, rather than C#. Reserve server events for things that really need to do work on the server. That will greatly improve perceived performance (no waiting for round-trips to a potentially-distant server) and help your server scale to handle more users by not needing to rebuild the entire html document for simple changes.






share|improve this answer















The code to load the grid is surrounded by an if (!IsPostBack) block. Guess what? The button click event causes a postback. That's how it runs. And every time you do a postback, the entire page starts over from scratch. That's how HTTP works.



So when you click the button, the data for the grid is not bound, and there is no selected row.



The best fix for this is to make this happen in javascript, rather than C#. Reserve server events for things that really need to do work on the server. That will greatly improve perceived performance (no waiting for round-trips to a potentially-distant server) and help your server scale to handle more users by not needing to rebuild the entire html document for simple changes.







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 7 at 5:29

























answered Mar 7 at 5:20









Joel CoehoornJoel Coehoorn

310k96495730




310k96495730












  • Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

    – Vesper Annstas
    Mar 7 at 5:26












  • @VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

    – Joel Coehoorn
    Mar 7 at 5:28






  • 1





    Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

    – Joel Coehoorn
    Mar 7 at 5:30

















  • Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

    – Vesper Annstas
    Mar 7 at 5:26












  • @VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

    – Joel Coehoorn
    Mar 7 at 5:28






  • 1





    Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

    – Joel Coehoorn
    Mar 7 at 5:30
















Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

– Vesper Annstas
Mar 7 at 5:26






Thanks, Joel! I commented out the <!-- language: c# -->if (!IsPostBack) lines so that the data would be bound when I click the button, but am still getting the same error.

– Vesper Annstas
Mar 7 at 5:26














@VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

– Joel Coehoorn
Mar 7 at 5:28





@VesperAnnstas That's an improvement... but ViewState is restored before the page load phase, so if the data isn't loaded earlier (Pre_Init is one option) there still can't be a selected row. I updated the answer to suggest a better fix, though.

– Joel Coehoorn
Mar 7 at 5:28




1




1





Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

– Joel Coehoorn
Mar 7 at 5:30





Oh: and use backtick characters (just below the escape key) in comments to mark code sections.

– Joel Coehoorn
Mar 7 at 5:30













0














Index starts from 0
gvConvo.SelectedRow.Cells[1] this field must be null



Try



gvConvo.SelectedRow.Cells[0]


Also check for gvConvo.SelectedRow
may be there is no selected in Grid






share|improve this answer























  • Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

    – Vesper Annstas
    Mar 7 at 5:20











  • Then gvConvo.SelectedRow must be NULL

    – Ashish Sapkale
    Mar 7 at 5:45















0














Index starts from 0
gvConvo.SelectedRow.Cells[1] this field must be null



Try



gvConvo.SelectedRow.Cells[0]


Also check for gvConvo.SelectedRow
may be there is no selected in Grid






share|improve this answer























  • Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

    – Vesper Annstas
    Mar 7 at 5:20











  • Then gvConvo.SelectedRow must be NULL

    – Ashish Sapkale
    Mar 7 at 5:45













0












0








0







Index starts from 0
gvConvo.SelectedRow.Cells[1] this field must be null



Try



gvConvo.SelectedRow.Cells[0]


Also check for gvConvo.SelectedRow
may be there is no selected in Grid






share|improve this answer













Index starts from 0
gvConvo.SelectedRow.Cells[1] this field must be null



Try



gvConvo.SelectedRow.Cells[0]


Also check for gvConvo.SelectedRow
may be there is no selected in Grid







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 7 at 5:13









Ashish SapkaleAshish Sapkale

455212




455212












  • Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

    – Vesper Annstas
    Mar 7 at 5:20











  • Then gvConvo.SelectedRow must be NULL

    – Ashish Sapkale
    Mar 7 at 5:45

















  • Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

    – Vesper Annstas
    Mar 7 at 5:20











  • Then gvConvo.SelectedRow must be NULL

    – Ashish Sapkale
    Mar 7 at 5:45
















Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

– Vesper Annstas
Mar 7 at 5:20





Thank you! [1] isn't null, but I did try setting it to [0] just in case. I still get the same error.

– Vesper Annstas
Mar 7 at 5:20













Then gvConvo.SelectedRow must be NULL

– Ashish Sapkale
Mar 7 at 5:45





Then gvConvo.SelectedRow must be NULL

– Ashish Sapkale
Mar 7 at 5:45



Popular posts from this blog

Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme