int32.parse

  • Thread starter Thread starter Mike P
  • Start date Start date
M

Mike P

Can anybody convert this from VB.NET to C#?

If Int32.Parse(ID) = Int32.Parse(dt.Rows(iLoop)("ID")) then
Return iLoop
End If

Thanks,

lfc77
 
Mike,

This is what you want.

if (Int32.Parse(ID) = Int32.Parse((string) dt.Rows[iLoop]["ID"]))
return iLoop;

This is assuming that the type of ID in the datatable is a string.

Hope this helps.
 
Can anybody convert this from VB.NET to C#?

If Int32.Parse(ID) = Int32.Parse(dt.Rows(iLoop)("ID")) then
Return iLoop
End If

Thanks,

lfc77

if(Int32.Parse(ID) == Int32.Parse(dt.Rows[iLoop]["ID"])
{
return iLoop;
}

Not sure if that will work, but you can try.
 
This is my code...I keep getting the error 'denotes a 'property' where a
'method' was expected'. Any ideas?

<asp:TemplateColumn HeaderText="CallType">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "CallType") %>
</ItemTemplate>

<EditItemTemplate>
<asp:DropDownList runat="server" id="lstCallTypes"
DataValueField="CallType"
DataTextField="CallType"
DataSource='<%# GetCallTypes() %>'
SelectedIndex='<%#
GetSelIndex(Container.DataItem("CallType")) %>'
/>
</EditItemTemplate>

</asp:TemplateColumn>


private int GetSelIndex(string strCallType)
{
int intLoop;
//Loop through each row in the DataSet
DataTable dt = ddlDataSet.Tables["CallTypes"];

for (intLoop = 0; intLoop >= dt.Rows.Count-1; intLoop ++)
{
if (Int32.Parse(strCallType) =
Int32.Parse((string)dt.Rows[intLoop]["CallType"]))
{
return intLoop;
}
}
}

Thanks,

Mike
 
Back
Top