私は MVC4 で小さなアプリケーションを作成しています。データベースを作成し、ユーザーが のような電話で URL を呼び出すたびにmyweb.com/xxxuuu
、情報を表示することができました。
しかし、私の情報をクリックしたときに、名前や電話番号などの情報を分割したいと思います。Links をもう一度クリックして、My email と facebooklink を表示します。
public ActionResult Entry2(string id)
{
DataSet1.userDataTable table = adapter.GetDatafromuserprofile(id);
ViewBag.username = table.Rows[0]["username"].ToString();
ViewData["userid"] = table.Rows[0]["userid"].ToString();
ViewData["username"] = table.Rows[0]["username"].ToString();
ViewData["userphone"] = table.Rows[0]["userphone"].ToString();
ViewData["useremail"] = table.Rows[0]["useremail"].ToString();
ViewData["userlink1"] = table.Rows[0]["userlink1"].ToString();
ViewData["userlink2"] = table.Rows[0]["userlink2"].ToString();
ViewData["usermessage"] = table.Rows[0]["usermessage"].ToString();
return View();
//var midata = adapter.obtenervalor(id);
}
これは私のルーターです:
routes.MapRoute(
name: "Profile",
url: "{id}",
defaults: new { controller = "Me", action = "Entry2" }
);
しかし、IDをコントローラーに送信してユーザーの追加データを取得する方法が見つかりませんxxxuuu
。
これが明確であり、解決策を教えていただけることを願っています。これは私のビューの最初の結果ですが、[マイ リンク] をクリックすると null 値が返されます。
ID: xxxuuu
henry@email.com
Henry
• Navigation
• My Info
• Contact Me
• My Links
• My Message