问题已经解决,解决方法如下:
string assetIDlr,assetIDl, assetIDr=string.Format("00000");
int intassetIDr=int.Parse("00000");
assetIDl = AssetID.Text.Substring(0,AssetID.Text.Length-5);
intassetIDr = Convert.ToInt32(AssetID.Text.Substring(AssetID.Text.Length-5));
for (int i = 0; i < Convert.ToInt32(Quantity.Text); i++)
{
switch (intassetIDr.ToString().Length)
{
case 1:
assetIDr = "0000" + intassetIDr.ToString();
break;
case 2:
assetIDr = "000" + intassetIDr.ToString();
break;
case 3:
assetIDr = "00" + intassetIDr.ToString();
break;
case 4:
assetIDr = "0" + intassetIDr.ToString();
break;
default:
assetIDr=intassetIDr.ToString();
break;
}
assetIDlr = assetIDl + assetIDr;