title: How do i pass a command argument of a button in Data List to another page?
body: <p>Actually i am trying to redirect command argument of a button present in a data list to another page. I am using Request.QueryString method to access the command argument on another page with the help of command name of the button. Please help me with it...</p>
  
  <p>this is code of button present inside Data List</p>
  
  <pre><code>    &lt;asp:Button ID="Button1" runat="server" Text="Read" CommandArgument='&lt;%# Eval("id")%&gt;' OnClick="Button1_Click"  CommandName="content"/&gt;
  </code></pre>
  
  <p>this is code present in DataList Item command function</p>
  
  <pre><code>     protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
      {
          Response.Redirect("content.aspx?content=" +e.CommandArgument.ToString());
  
      }
  </code></pre>
  
  <p>this is the onclick function code</p>
  
  <pre><code>    protected void Button1_Click(object sender, EventArgs e)
      {
          Response.Redirect("content.aspx");
      }
  </code></pre>
  
  <p>this is the code on another page(content.aspx)</p>
  
  <pre><code>    protected void Page_Load(object sender, EventArgs e)
      {
          if (!IsPostBack)
          {
              String id = Request.QueryString["content"];
              Label1.Text = id;
          }                          
      }
  </code></pre>
  
  <p>this is entire datalist code</p>
  
  <pre><code>    &lt;asp:DataList ID="DataList1" runat="server"  DataKeyField="Id" DataSourceID="SqlDataSource1" Height="657px" RepeatColumns="4" RepeatDirection="Horizontal" Width="1248px" OnItemCommand="DataList1_ItemCommand" OnItemDataBound="DataList1_ItemDataBound"&gt;
  &lt;FooterStyle BackColor="White" ForeColor="#000066" /&gt;
  &lt;HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" /&gt;
  &lt;ItemStyle ForeColor="#000066" /&gt;
  &lt;ItemTemplate&gt;
      &lt;table class="auto-style2"&gt;
          &lt;tr&gt;
              &lt;td style="text-align: center"&gt;
                  &lt;asp:Label ID="Label2" runat="server" Text='&lt;%# Eval("name") %&gt;'&gt;&lt;/asp:Label&gt;
                  &amp;nbsp;&amp;nbsp;&amp;nbsp;
                  &lt;asp:Label ID="Label4" runat="server" Text='&lt;%# Eval("Id") %&gt;' Visible="False"&gt;&lt;/asp:Label&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="text-align: center"&gt;
                  &lt;asp:Image ID="Image2" runat="server" Height="250px" ImageUrl='&lt;%# Eval("image") %&gt;' Width="250px" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="text-align: center"&gt;
                  &lt;asp:Label ID="Label3" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;
                  &lt;br /&gt;
                  &lt;asp:ImageButton ID="ImageButton1" runat="server" CommandName="addtofav" CommandArgument='&lt;%# Eval("id")%&gt;' Height="30px" Width="20px" /&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td style="text-align: center"&gt;
                  &lt;asp:Button ID="Button1" runat="server" Text="Read" CommandArgument='&lt;%# Eval("id")%&gt;' OnClick="Button1_Click"  CommandName="content"/&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table
      &lt;br /&gt;
      &lt;br /&gt;
  &lt;/ItemTemplate&gt;
  &lt;SelectedItemStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>it does redirect to another page(content.aspx) but the label does not show the querystring text.</p>