0

I have a datalist for list of documents enter image description here

 <asp:DataList ID="DLDossierList" runat="server" >

            <ItemTemplate>

                <div class="doss_hea_seno_2" url="dossier_timeline.aspx">
                   .
                   .
        <asp:HiddenField ID="hfDocNo" runat="server" Value='<%#("DoCNo") %>' />

                   .
                </div>

            </ItemTemplate>
        </asp:DataList>

I want to redirect to another page when he clicks on (div) list item i.e document name . for this I am using following script :

<script>
            $(document).ready(function () {
                $('.doss_hea_seno_2').click(function () {
                    window.parent.location = $(this).attr("url");
                    return false;

                });

            });
</script>

but now I want to pass hidden field value as a query string . how can i achieve this ?

2 Answers 2

1

You can have the custom query string as data attribute (data-querystring) and do something similar to the following:

You can add the data attribute on DataBound from code behind

<script>
         $(document).ready(function () {
             $('.doss_hea_seno_2').click(function () {
                 window.parent.location = $(this).attr("url") + "?customqs=" + $(this).data("querystring");
                 return false;
              });
           });
</script>
Sign up to request clarification or add additional context in comments.

Comments

0

As I remember, WebForms creates ids for elements like Somthing_DLDossierList_hfDocNo

Then you can look for the hidden input field like this:

$('[id$="hfDocNo"]').val() // -> value of the field

jquery doc

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.