الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

كيف أرسل parameter ل grid view؟؟؟

مغلق
بدأه دونا في 10 ديسمبر 2006 · 6 رد · 1,213 مشاهدة · في ASP.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم و رحمة الله و بركــــــاته

لدي مشكلة اتمنى أن اجد حلها لديكم..

قمت بإنشاء

grid view خاصة بمجموعة المواد

و بجانب كل مادة وضعت زر بحيث إذا ضغط عليها المستخدم انتقل إلى صفحة أخرى فيها gridview بمعلومات الطلاب المسجلين في هذه المادة..

و حتى أحصل على ذلك جعلت كل زر يرسل عند الضغط عليه رمز المادة التي يقع بجوارها باستخدام الأمر Response.Redirect إلى الصفحة التالية التي سيعرض فيها طلبها..

وقمت ببناء gridview الطلاب بــاستخدام wizerd بحيث أني جعلتها تقوم على الكويري التالية:

select * from student Where CoursId=@CoursId

المشكلة هي كيف أجعل GRID VIEW الطلاب تأخذ رمز المادة المرسل لها من الصفحة السابقة كــ parameter للكويري السابقة؟؟؟

أي..

كيف أجعل الكويري السايقة تعادل هذه باستخدام WIZERD

["select * from student Where CoursId=Request["CoursId

انتظركم..

في أمان الله..

#2

تشغيلك للgrid view من خلال الـ SqlDataSource

إجعل الـ SqlDataSourceيستقبل متغير من خلال الـ session او querystring او اي من الاختيارات الموجوده في الـ wizerd

رســالـة من يتيــم

AytamResalhGIFmesg.gif

http://www.aytam.org.sa/message_aytam.php

----

أتمنى لك التوفيق اخي cold0zero في موقعك

logo.gif
#3

اذا نجحت معك الطريقه ياليت ترفق الملفات

#4

حاولت أستخدم الي ذكرتهم..

session ما تصلح لأنه أخذ رمز أول مادة و ما رضي يغيرها..

أما query string ما عرفت أستخدمها..

أريد شيئا يستطيع أن يسقبل parameter هو أصلا ["request["courseID

#5

بتقدر تنقل قيمة الخلية في العمود الت تريده من datagrid عل النحو التالي:

VB.net 2003:

session.add("ID",DataGrid1.Items(DataGrid1.SelectedIndex).Cells(3).Text)

vb.net 2005

GridView2.Rows(GridView2.SelectedIndex).Cells(1).Text()

طبعا في ال DataGrid1_SelectedIndexChanged

as:

Private Sub DataGrid1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.SelectedIndexChanged

session("ID",DataGrid1.Items(DataGrid1.SelectedIndex).Cells(3).Text)

End Sub

#6

يا عزيزي الموضوع ابسط بكثير مما تتصور

في الصفحة الجديده يوجد بها gridview

شغل الـ Configure data source

حدد الاتصال في الدايلوق الاول

G1.JPG

بعدها حدد أي الجداول تريد العمل عليها ؟

G2.JPG

نأتي للمهم الان

اضغط على where ليتم تحديد الشروط المطلوبه

وشرطنا هو.. عرض جميع المواد ذات الرمز x

طبعاً الرمز x هو مرسل من قبل المستخدم من الصفحة السابقة

( وهذه الصفحة لا تعمل إلا من قبل قيمة مرسلة من الصفحة السابقة )

بعد دخولنا للشروط

نحدد الحقل اللذي سوف نربطه بالقيمة المرسلة وهو لديك ( CoursId )

ونقول الحقل CoursId ( بالمثال هنا accountType )

العملية =

المصدر نحدد الـ QueryString

ونكتب اسم المتغير المرسل من الصفحة السابقة وهو لديك ايضاً CoursId ( بالمثال هنا ActType)

بعدها نضغط على الزر Add

G3.JPG

حاول وانتظر ردك

تحياتي

رســالـة من يتيــم

AytamResalhGIFmesg.gif

http://www.aytam.org.sa/message_aytam.php

----

أتمنى لك التوفيق اخي cold0zero في موقعك

logo.gif
#7

here i am going to explain how to add links to grid view

i have a jobs table that has the following fields

jobs_table.jpg

in a gridview i need only the job title and date_added fields to be displayed where the job_title will be a link to view all details of the specified job i.e. to get all other fields from the database

so i will start with dragging a gridview control to add it to the page and add new data source

gridview.jpg

i will choose the data source to be the jobs table and also check the fields i need to display in the gridview which will be the id,job_title and date_added

select_query.jpg

i will test the query to see if it's working

test_query.jpg

after everything is ok i click on the gridview and select edit columns

edit_columns.jpg

in the edit columns screen i will add HyberLinkedField and edit it's properties as shown in the next figure

fields.jpg

where the DataNavigateUrlField will be the id to send it as URL parameter to the next page

and the DataNavigateUrlFormatString will be the page where i am redirecting to which will be view_details.aspx?id={0} where 0 is the first column specified in the query which is the id of the job

and the DataTextField will be the job_title field where it will be displayed as a link

and in the HeaderText i will write jobs

then i will remove the job_title from the selected_fields pane as it will be displayed in the hyperlink column so everything will look like the following

final.jpg

then i view the page in the browser

page_in_browser.jpg

next i am going to create the view_details.aspx page where it will display the full data about the select job

i will add gridview control to this page and choose the data source to be the job table and select which fields i want to display

view_details.jpg

then i will click where to choose the selected row according to the id sent from the previous gridview control on the browse_jobs.aspx

where.jpg

and i click add so that where clause is added to the query then click ok

Mohamed BADR

Senior PHP developer

http://www.mohamedbadr.com

هذا الموضوع مغلق.

مواضيع مشابهة