Click here to Skip to main content
15,897,518 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Question$find() is not working Pin
Ali Al Omairi(Abu AlHassan)3-Jun-11 8:35
professionalAli Al Omairi(Abu AlHassan)3-Jun-11 8:35 
AnswerRe: $find() is not working Pin
Pete O'Hanlon3-Jun-11 9:58
mvePete O'Hanlon3-Jun-11 9:58 
GeneralRe: $find() is not working Pin
Ali Al Omairi(Abu AlHassan)3-Jun-11 10:09
professionalAli Al Omairi(Abu AlHassan)3-Jun-11 10:09 
GeneralRe: $find() is not working Pin
Pete O'Hanlon3-Jun-11 10:11
mvePete O'Hanlon3-Jun-11 10:11 
GeneralRe: $find() is not working Pin
Ali Al Omairi(Abu AlHassan)3-Jun-11 10:19
professionalAli Al Omairi(Abu AlHassan)3-Jun-11 10:19 
GeneralRe: $find() is not working Pin
Pete O'Hanlon3-Jun-11 10:40
mvePete O'Hanlon3-Jun-11 10:40 
GeneralRe: $find() is not working Pin
Ali Al Omairi(Abu AlHassan)3-Jun-11 10:47
professionalAli Al Omairi(Abu AlHassan)3-Jun-11 10:47 
Questionwhat to use instead of ` Command Argument property`in a` gridview` When I create the gridview in client side using jquery? Pin
Ramin Morfi3-Jun-11 3:20
Ramin Morfi3-Jun-11 3:20 
Suppose I have following table in my database:

Tbl_Persons:
    Id   Country    Name
    1    Australia  Ben
    2    Japan      John
    3    Korea      Libby
    4    Australia  Raymond


I use following Query and bind the result using `DataTable` to a `Gridview`.


select id,Country,Name 
           from tbl_persons
               where country='Australia'


In `gridview` I have two `Bound Columns` and 1 `template column`.
In template column I typically put an `ImageButton` and assign the `ID field` to `image button` using `Command Argumnet property`. And when user clicks on the `imagebutton` in the browser I'll get the `command argument value` in sever an do some operations with it.

<asp:GridView ID="GridView1" runat="server">
              <Columns>
                  <asp:BoundField DataField="ountry" HeaderText="Country" />
                  <asp:BoundField DataField="Name" HeaderText="Name" />
                  <asp:TemplateField>
                      <ItemTemplate>
                          <asp:ImageButton ID="ImageButton1" runat="server"
                              CommandArgument='<%# Eval("Id") %>' />
                      </ItemTemplate>
                  </asp:TemplateField>
              </Columns>
          </asp:GridView>


As you know in runtime mode when user views the source of code in browser the values of `command argument` are not observable because they create in server. and user can't change the values using the browser and send the changed values to the server.

But `gridview` is server side an has post back. So I use `jquery` and fill `My gridview` with appending `tr` and `td` tags in client side.
For `ID field of my database` because I don't have `command argument` in client side I assign the `Id` of each `TD` tag equals to the `Id field`.
But the user can change the `Id values` in the browser and send invalid data to the server and this is a disaster.
This is piece of my code:

script type="text/javascript">
      function BindGridView() {
         $.ajax({
              type: "POST",
              url: "Default.aspx/GetNames",
              data: "{}",
              contentType: "application/json",
              dataType: "json",
              success: function (data) {
             for (var i = 0; i < data.d.length; i++) {
                    $("#NamesGridView").append("<tr><td id="+data.d[i].Id+">" + data.d[i].Country + 
                                                "</td><td>" + data.d[i].Name + "</td></tr>");
                 }
               }
              })
          }
    </script>


So what can I do to prevent user to changes the values?
Are there any ways something like Command Argument in client side?
AnswerRe: what to use instead of ` Command Argument property`in a` gridview` When I create the gridview in client side using jquery? Pin
Ali Al Omairi(Abu AlHassan)3-Jun-11 9:18
professionalAli Al Omairi(Abu AlHassan)3-Jun-11 9:18 
GeneralRe: what to use instead of ` Command Argument property`in a` gridview` When I create the gridview in client side using jquery? Pin
Ramin Morfi3-Jun-11 10:36
Ramin Morfi3-Jun-11 10:36 
Questionrefresh Pin
tanzeel853-Jun-11 2:10
tanzeel853-Jun-11 2:10 
AnswerRe: refresh Pin
shankysharma863-Jun-11 2:21
shankysharma863-Jun-11 2:21 
GeneralRe: refresh Pin
tanzeel853-Jun-11 2:33
tanzeel853-Jun-11 2:33 
GeneralRe: refresh Pin
Blue_Boy3-Jun-11 2:44
Blue_Boy3-Jun-11 2:44 
AnswerRe: refresh Pin
Monjurul Habib4-Jun-11 11:25
professionalMonjurul Habib4-Jun-11 11:25 
QuestionSend value to server side Pin
Elham M3-Jun-11 1:40
Elham M3-Jun-11 1:40 
AnswerRe: Send value to server side Pin
Not Active3-Jun-11 2:02
mentorNot Active3-Jun-11 2:02 
GeneralRe: Send value to server side Pin
Elham M4-Jun-11 9:39
Elham M4-Jun-11 9:39 
GeneralRe: Send value to server side Pin
Not Active4-Jun-11 10:08
mentorNot Active4-Jun-11 10:08 
GeneralRe: Send value to server side Pin
Elham M4-Jun-11 20:08
Elham M4-Jun-11 20:08 
GeneralRe: Send value to server side Pin
Not Active5-Jun-11 2:23
mentorNot Active5-Jun-11 2:23 
GeneralRe: Send value to server side Pin
Elham M5-Jun-11 7:47
Elham M5-Jun-11 7:47 
GeneralRe: Send value to server side Pin
Not Active5-Jun-11 8:25
mentorNot Active5-Jun-11 8:25 
GeneralRe: Send value to server side Pin
Elham M6-Jun-11 0:55
Elham M6-Jun-11 0:55 
GeneralRe: Send value to server side Pin
Not Active6-Jun-11 1:52
mentorNot Active6-Jun-11 1:52 

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.