Click here to Skip to main content
15,886,362 members
Home / Discussions / C#
   

C#

 
AnswerRe: update twitter status Pin
Tony Richards5-Apr-10 12:02
Tony Richards5-Apr-10 12:02 
QuestionI hope this is a stupid question - Pulling CLOB data from a Stream, performing logic, and then spinning off a new Stream for further processing Pin
Alaric_5-Apr-10 10:16
professionalAlaric_5-Apr-10 10:16 
Questionsetting identity specification to yes from c# Pin
teknolog1235-Apr-10 8:14
teknolog1235-Apr-10 8:14 
AnswerRe: setting identity specification to yes from c# Pin
Dan Mos5-Apr-10 9:00
Dan Mos5-Apr-10 9:00 
GeneralRe: setting identity specification to yes from c# Pin
teknolog1235-Apr-10 9:06
teknolog1235-Apr-10 9:06 
GeneralRe: setting identity specification to yes from c# Pin
AspDotNetDev5-Apr-10 10:34
protectorAspDotNetDev5-Apr-10 10:34 
GeneralRe: setting identity specification to yes from c# Pin
teknolog1235-Apr-10 22:48
teknolog1235-Apr-10 22:48 
QuestionPass variable from GridViewRowEvent method to DataListItemEvent method in C# using ASP.NET Pin
chris.hagelstein5-Apr-10 6:43
chris.hagelstein5-Apr-10 6:43 
I'm trying to pass a variable from a GridViewRowEvent method to a DataListItemEvent method in a C# program.

I have the following:

public void My_RowDataBound2(object sender, GridViewRowEventArgs e)
    {
      if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int lblAmount = (int)DataBinder.Eval(e.Row.DataItem, "Amount");
            totalAmount += lblAmount;
            x += 1;
        }
        else
        {
            CountNumberRows(x);
        }
     }

public int CountNumberRows(int x) { return x; }

public void My_ItemDataBound(object sender, DataListItemEventArgs e) {
  if (e.Item.DataItem != null)
    {
       Label dummyVariable = (Label)e.Item.FindControl("abc");
       abc.Text = CountNumberRows(x).ToString();
     }
}


Then in my ASP.NET file I have the following entry:

  DataList
...
  Gridview
...
  Gridview
...
  <asp:Label ID="abc" runat="server"></asp>
...
  DataList


And I get just "0" for the "abc" value in my file. I know the GridViewEvent method works because the variable
totalAmount
correctly sums up all the data each time it is called by My_RowDataBound2, and inserted into the appropriate place in the GridView on my ASP.NET Page. But "abc" just shows 0. abc is just supposed to show the number of rows contained in the GridView.

Basically, I just need to get the "x" value from
My_RowDataBound2
method, pass it to the
My_ItemDataBound
event which then passes it as a label to the ASP.NET Page. But the label is just showing "0"


If I take:
public int CountNumberRows(int x) { return x; }
and change it to:
public int CountNumberRows(int x) { x= "123"; return x; } 
, it passes the "123" to the abc label. But I don't know how to pass the x calculation out of the GridView to the DataList. Any suggestions? I appreciate your help
Questionftp server folders Pin
Priya Prk5-Apr-10 6:23
Priya Prk5-Apr-10 6:23 
AnswerRe: ftp server folders Pin
Not Active5-Apr-10 6:47
mentorNot Active5-Apr-10 6:47 
GeneralRe: ftp server folders Pin
Priya Prk5-Apr-10 21:16
Priya Prk5-Apr-10 21:16 
GeneralRe: ftp server folders Pin
Not Active6-Apr-10 2:47
mentorNot Active6-Apr-10 2:47 
Questionget the file type of a file Pin
aleroot5-Apr-10 4:32
aleroot5-Apr-10 4:32 
AnswerRe: get the file type of a file [modified] Pin
PIEBALDconsult5-Apr-10 4:53
mvePIEBALDconsult5-Apr-10 4:53 
GeneralRe: get the file type of a file Pin
aleroot5-Apr-10 7:15
aleroot5-Apr-10 7:15 
GeneralRe: get the file type of a file [modified] Pin
harold aptroot5-Apr-10 7:19
harold aptroot5-Apr-10 7:19 
GeneralRe: get the file type of a file Pin
harold aptroot5-Apr-10 12:45
harold aptroot5-Apr-10 12:45 
GeneralRe: get the file type of a file Pin
Dave Kreskowiak5-Apr-10 7:54
mveDave Kreskowiak5-Apr-10 7:54 
GeneralRe: get the file type of a file Pin
PIEBALDconsult5-Apr-10 8:48
mvePIEBALDconsult5-Apr-10 8:48 
GeneralRe: get the file type of a file Pin
Dave Kreskowiak5-Apr-10 10:19
mveDave Kreskowiak5-Apr-10 10:19 
GeneralRe: get the file type of a file Pin
PIEBALDconsult5-Apr-10 12:02
mvePIEBALDconsult5-Apr-10 12:02 
AnswerRe: get the file type of a file Pin
harold aptroot5-Apr-10 5:11
harold aptroot5-Apr-10 5:11 
GeneralRe: get the file type of a file Pin
PIEBALDconsult5-Apr-10 9:29
mvePIEBALDconsult5-Apr-10 9:29 
GeneralRe: get the file type of a file Pin
harold aptroot5-Apr-10 12:35
harold aptroot5-Apr-10 12:35 
AnswerRe: get the file type of a file Pin
AspDotNetDev5-Apr-10 11:40
protectorAspDotNetDev5-Apr-10 11:40 

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.