Hi All,
I created a button in a radgrid with below code. When I try to reach the value in columns that is okay. I can make it.
But I try to make a request with these parameters on my web service. I get this error "property of value is null or undefined" at runtime.
Now I am thinking I create these buttons dynamically. Is that the reason I cant make a request?
Please help.
I created a button in a radgrid with below code. When I try to reach the value in columns that is okay. I can make it.
But I try to make a request with these parameters on my web service. I get this error "property of value is null or undefined" at runtime.
Now I am thinking I create these buttons dynamically. Is that the reason I cant make a request?
Please help.
protected
void
rgGeneralSearch_ItemDataBound(
object
sender, GridItemEventArgs e)<br> {<br><br>
if
(e.Item
is
GridDataItem)<br> {<br> GridDataItem gridDataItem = (GridDataItem)e.Item;<br> Button btnAdd =<br> (Button)gridDataItem[
"Add"
].FindControl(
"btnAdd"
);<br> RadNumericTextBox txtQuantity =<br> (RadNumericTextBox)gridDataItem[
"Quantity"
].FindControl(
"txtQuantity"
);<br><br><br>
//btnAdd.Attributes["onclick"] = "btnAddClick('" + txtQuantity.ClientID + ", "+ rgGeneralSearch.MasterTableView.GetColumn("Code") + "')";<br> btnAdd.Attributes["onclick"] = "btnAddClick('" + txtQuantity.ClientID + "', '"+ e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Code"] +"')";<br> //btnAdd.Attributes["href"] = "#";<br> btnAdd.Attributes.Add("ajax", "");<br> }<br> }
function
btnAddClick(Quantity, Code) {<br> alert($get(Quantity).value);<br> alert(Code);<br><br>
var
SenderType = 1;<br>
var
SenderId = 22;<br>
var
ProductId = 333;<br>
var
CustomerId = 99;<br>
var
SalesmanId = 88;<br>
var
DiscSpecial = 23;<br>
var
TerminalNumber = 234;<br><br>
var
webMethod =
"http://localhost:5261/WS/Basket_WS.asmx/InsertBasket"
; <br>
var
parameters =
"{'SenderType':'"
+ SenderType +
"', 'SenderId':'"
+ SenderId +
"', 'ProductId':'"
+ ProductId +
"', 'CustomerId':'"
+ CustomerId +
"', 'SalesmanId':'"
+ SalesmanId +
"', 'Quantity':'"
+ 22 +
"','DiscSpecial':'"
+ DiscSpecial +
"','TerminalNumber':'"
+ TerminalNumber +
"'}"
; <br> $.ajax({<br> type:
"GET"
,<br> url: webMethod,<br> data: parameters,<br> contentType:
"application/json; charset=utf-8"
,<br> dataType:
"json"
,<br> success: OnGetSuccess,<br> error: OnGetError<br> });<br>}