Rewant Choudhary

Rewant Choudhary

  • NA
  • 441
  • 111.5k

string Problem

Nov 6 2012 12:42 AM
 string attr = string.Empty;

 for (int i = 1; i <= dtattr.Rows.Count - 1; i++)
  {

  attr += "<button id='add_item_" + i + "' type='button' rel=" + dtattr.Rows[i]["AttributeDataType"].ToString() + " onclick='add_item($(this).attr(" + i + "), 1);'>Add Item</button>
}


output showing


<button onclick="add_item($(this).attr(1), 1);" list="" rel="Drop" type="button" id="add_item_1">Add Item</button>

i want this

<button onclick="add_item($(this).attr('1'), 1);" list="" rel="Drop" type="button" id="add_item_1">Add Item</button>

Thanks in Advance.

Answers (1)