1

I have a datalist which using objectdatasource.Objectdatasource using business layer.

dataworks.cs

  public static List<Yorum> SerchYorumlariGetir(string tag)
    {
        List<Yorum> yorum_listesi = new List<Yorum>();



        try
        {
            using (SqlConnection baglanti = new SqlConnection(dbconnect()))
            {

                SqlCommand komut = new SqlCommand("sp_search_yorum_getir", baglanti);
                komut.CommandType = CommandType.StoredProcedure;
                komut.Parameters.AddWithValue("@tag", tag);

                Yorum yorum = default(Yorum);


                baglanti.Open();
                using (SqlDataReader dr = komut.ExecuteReader(CommandBehavior.CloseConnection))
                {
                    while (dr.Read())
                    {
                        yorum = new Yorum();
                        yorum.Yorum_ID = dr.GetInt32(dr.GetOrdinal("comment_id"));
                        yorum.Post_ID = dr.GetInt32(dr.GetOrdinal("comment_post_id"));
                        yorum.User_ID = dr.GetGuid(dr.GetOrdinal("comment_user_id"));
                        yorum.Yorum_UserName = dr.GetString(dr.GetOrdinal("UserName"));
                        yorum.Yorum_Text = dr.GetString(dr.GetOrdinal("comment_text"));
                        yorum.Yorum_Like = dr.GetInt32(dr.GetOrdinal("comment_like"));
                        yorum.Yorum_Dislike = dr.GetInt32(dr.GetOrdinal("comment_dislike"));
                        yorum.Yorum_ReplyTo_ID = dr.GetInt32(dr.GetOrdinal("comment_reply_to_id"));
                        yorum.Yorum_Date = dr.GetDateTime(dr.GetOrdinal("comment_date"));
                        yorum.Yorum_Post_Etiket = dr.GetString(dr.GetOrdinal("post_etiket"));
                        yorum.Yorum_Profil_Foto_Kucuk = dr.GetString(dr.GetOrdinal("profil_foto_kucuk"));
                        yorum.Yorum_Profil_Foto_Buyuk = dr.GetString(dr.GetOrdinal("profil_foto_buyuk"));
                        yorum_listesi.Add(yorum);
                    }
                    dr.Close();
                }
            }
        }
        catch (Exception ex)
        {

            throw ex;
        }
        return yorum_listesi;
    }

and yonet.cs

    public static List<Yorum> TagYorum(string tag)
   {
       return data_works.SerchYorumlariGetir(tag);
   }

and objectdatasource

  <asp:ObjectDataSource ID="ods_search_yorumlar" runat="server" TypeName="yonet"  SelectMethod="TagYorum">
            <SelectParameters>
            <asp:QueryStringParameter Type="String" QueryStringField="tag"  />
            </SelectParameters>
  </asp:ObjectDataSource>    

I am using this methods on other page.and ther wasnt error, but on this page it's throwing this error:

ObjectDataSource 'ods_search_yorumlar' could not find a non-generic method 'TagYorum' that has no parameters.

I can't understand why this happens.

2
  • What if you add DefaultValue to the QueryStringParameter? Commented Apr 29, 2013 at 17:10
  • same error.I added :/ Commented Apr 29, 2013 at 17:11

1 Answer 1

2

You need to add Name to the QueryStringParameter, which corresponds to the name of the parameter to your function:

<asp:QueryStringParameter Type="String" DefaultValue="0"
QueryStringField="tag" Name="tag"/>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.