I have a scenario where i have to select the drop value based on querystring.
Query string could be likeq=c-1
q=c-2
q=p-5
and value in drop-down could be value="8-P-5"
value="5-G-0"
value="7-P-7"
How can i select the drop-down value based on query-string
Is it possible to do it from Code-behind C# or jquery is easy solution.
<select name="ctl00$ContentPlaceHolder1$ddlOptionGroup" id="ContentPlaceHolder1_ddlOptionGroup" class="form-control">
<option value="1-C-1">Item 1</option>
<option value="4-C-2">Item 2</option>
<option value="5-G-0">Item 3</option>
<option value="7-P-7">Item 4</option>
<option value="8-P-5">Item 5</option>
<option value="10-C-4">Item 6</option>
<option value="3-P-0">Item 7</option>
<option value="2-P-0">Item 8</option>
<option value="6-G-0">Item 9</option>
</select>
If query-string is q=c-2
then this should be selected <option value="4-C-2" selected>Item 2</option>
q=c-2
and on the other page i have to pre select the drop-down that partly matches the query string. I have Category Page & Project Page and ID of both can be same so to preselect to correctly select the item in the drop-down i am prefixing valie with C & P, C for Category & P for projectvalue
inoptions
will be unique right?