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

Thal And Out Agency railway station See also References External links Navigation menuOfficial Web Site of Pakistan RailwaysArchivedOfficial Web Site of Pakistan Railwayseeexpanding ite

Understanding generators in Python2019 Community Moderator ElectionGenerator function not working pythonFor loop not executing two timesGenerators - Printing generated valuesWhy can a python generator only be used once?What exactly do generators do?What does the “yield” keyword do?What does “list comprehension” mean? How does it work and how can I use it?sklearn Kfold acces single fold instead of for loopIs a generator the callable? Which is the generator?Apply Border To Range Of Cells Using OpenpyxlCalling an external command in PythonWhat are metaclasses in Python?What is the difference between @staticmethod and @classmethod?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?Understanding slice notationUnderstanding Python super() with __init__() methodsDoes Python have a string 'contains' substring method?

How can I change the color of pagination dots of UIPageControl?How to change UIPageControl dotsIs there a way to change page indicator dots colorCustomize dot with image of UIPageControl at index 0 of UIPageControlNo visible @interface for 'NSObject<PageControlDelegate>' declares the selector 'pageControlPageDidChange:'How to change the color of pagination dots in UIPageControl with a different color per pagepagecontrol indicator custom image instead of DefaultChanging the colour of UIPageControl dots in MonoTouchpagecontrol selectable page visibility color?Alternative way to load ViewControllers on a UIPageControlHow to set only layer.border-color for UIpage control dots in swiftHow can I develop for iPhone using a Windows development machine?How to change the name of an iOS app?UITableView - change section header coloruipagecontrol indicator(dot)issueCustom UIPageControl dots color not changingchange the interspace between UIPageControl dotsHow to change Status Bar text color in iOSHow can I change image tintColor in iOS and WatchKitUIPageControl dots with larger space in between each dotsHow to change the color of pagination dots in UIPageControl with a different color per page