0

How do I create dynamic keyboard button bot telegram in C#?

For example, read value from database and set value to button also count of button equal database row.

Pang
  • 9,564
  • 146
  • 81
  • 122

1 Answers1

0

you can read data base cell and insert as text [\""+SqlDataReaderTest["YouDataCell"].ToString()+"\"]

 string keyboard= "&reply_markup={\"keyboard\":[";
 string temp="";
 while (SqlDataReaderTest.Read())
                {
         temp+=(temp.length==0?"[\"":"],[\"")+SqlDataReaderTest["YouDataCell"].ToString()+"\"]";
                }
keyboard+=temp+"}";

remember your (message + keyboard) Length Must be no more than 4000 characters

Arya
  • 11
  • 5